Skip to content

Commit

Permalink
Merge pull request #14 from eea/develop
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
tiberiuichim authored Oct 7, 2024
2 parents 4af7671 + 5e48c8b commit 0fe4040
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 8 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file. Dates are d

Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).

### [0.1.6](https://github.com/eea/volto-chatbot/compare/0.1.5...0.1.6) - 7 October 2024

#### :bug: Bug Fixes

- fix: prevent scroll on edit mode - refs #277196 [kreafox - [`69f7200`](https://github.com/eea/volto-chatbot/commit/69f7200f415b6906111ff250276ed4a870a62579)]
- fix: use proper name for edit block component [kreafox - [`07dcb44`](https://github.com/eea/volto-chatbot/commit/07dcb44e544c58563826a9487c524149ece80732)]

#### :house: Internal changes

- style: Automated code fix [eea-jenkins - [`a00832a`](https://github.com/eea/volto-chatbot/commit/a00832a5b2170fe03b0be218e12eeef3e11926c1)]

### [0.1.5](https://github.com/eea/volto-chatbot/compare/0.1.4...0.1.5) - 4 October 2024

#### :rocket: New Features
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@eeacms/volto-chatbot",
"version": "0.1.5",
"version": "0.1.6",
"description": "@eeacms/volto-chatbot: Volto add-on",
"main": "src/index.js",
"author": "European Environment Agency: IDM2 A-Team",
Expand Down
6 changes: 3 additions & 3 deletions src/ChatBlock/ChatBlockEdit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import ChatBlockView from './ChatBlockView';
import { ChatBlockSchema } from './schema';
import withDanswerData from './withDanswerData';

const SearchBlockEdit = (props) => {
const ChatBlockEdit = (props) => {
const { onChangeBlock, block, assistants } = props;

const schema = React.useMemo(
Expand All @@ -16,7 +16,7 @@ const SearchBlockEdit = (props) => {

return (
<div>
<ChatBlockView {...props} mode="edit" />
<ChatBlockView {...props} isEditMode />
<SidebarPortal selected={props.selected}>
<BlockDataForm
schema={schema}
Expand All @@ -39,4 +39,4 @@ const SearchBlockEdit = (props) => {
export default withDanswerData(() => [
'assistants',
superagent.get('/_da/persona?include_deleted=false').type('json'),
])(SearchBlockEdit);
])(ChatBlockEdit);
4 changes: 2 additions & 2 deletions src/ChatBlock/ChatBlockView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import ChatWindow from './ChatWindow';
import superagent from 'superagent';

function ChatBlockView(props) {
const { assistantData, data } = props;
const { assistantData, data, isEditMode } = props;

return assistantData ? (
<ChatWindow persona={assistantData} {...data} />
<ChatWindow persona={assistantData} isEditMode={isEditMode} {...data} />
) : (
<div>Chatbot</div>
);
Expand Down
5 changes: 3 additions & 2 deletions src/ChatBlock/ChatWindow.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ function ChatWindow({
rehypePrism,
remarkGfm,
placeholderPrompt = 'Ask a question',
isEditMode,
...data
}) {
const { height, qgenAsistantId, enableQgen, scrollToInput } = data;
Expand All @@ -36,12 +37,12 @@ function ChatWindow({
const scrollDist = React.useRef(0); // Keep track of scroll distance

React.useEffect(() => {
if (!textareaRef.current) return;
if (!textareaRef.current || isEditMode) return;

if (isStreaming || scrollToInput) {
textareaRef.current.focus();
}
}, [isStreaming, scrollToInput]);
}, [isStreaming, scrollToInput, isEditMode]);

const handleClearChat = () => {
clearChat();
Expand Down

0 comments on commit 0fe4040

Please sign in to comment.