Skip to content

Commit 82b8b94

Browse files
authored
Merge pull request #234 from awslabs/hotfix/v3.5.1
Hotfix v3.5.1 into Main
2 parents 7882a42 + abfb7cb commit 82b8b94

File tree

11 files changed

+250
-97
lines changed

11 files changed

+250
-97
lines changed

CHANGELOG.md

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
# v3.5.1
2+
3+
## Bug Fixes
4+
5+
### Chat Session Management
6+
7+
- Resolved url redirect issue that prevented creation of new chat sessions via the New button
8+
- Resolved intermittent loading issues when accessing historical conversations due to LangChain memory object
9+
- Addressed error handling for LLM interactions after multiple prompts
10+
11+
### Document Summarization
12+
13+
- Fixed stability issues with document summarization functionality in existing chat sessions
14+
15+
### UI
16+
17+
-Corrected display scaling issues in Firefox for large screen resolutions
18+
119
# v3.5.0
220
## Key Features
321
### User Interface Modernization

VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.5.0
1+
3.5.1

lib/user-interface/react/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "lisa-web",
33
"private": true,
4-
"version": "3.5.0",
4+
"version": "3.5.1",
55
"type": "module",
66
"scripts": {
77
"dev": "vite",

lib/user-interface/react/src/components/chatbot/Chat.tsx

+26-19
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,30 @@
1414
limitations under the License.
1515
*/
1616

17-
import { useState, useRef, useCallback, useEffect, useMemo } from 'react';
17+
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
1818
import { useAuth } from 'react-oidc-context';
1919
import Form from '@cloudscape-design/components/form';
2020
import Container from '@cloudscape-design/components/container';
2121
import Box from '@cloudscape-design/components/box';
2222
import { v4 as uuidv4 } from 'uuid';
2323
import SpaceBetween from '@cloudscape-design/components/space-between';
24-
import { Grid, TextContent, PromptInput, Autosuggest, ButtonGroup } from '@cloudscape-design/components';
24+
import {
25+
Autosuggest,
26+
ButtonGroup,
27+
ButtonGroupProps,
28+
Grid,
29+
PromptInput,
30+
TextContent,
31+
} from '@cloudscape-design/components';
2532
import StatusIndicator from '@cloudscape-design/components/status-indicator';
2633

2734
import Message from './Message';
28-
import { LisaChatMessage, LisaChatSession, LisaChatMessageMetadata } from '../types';
29-
import { RESTAPI_URI, formatDocumentsAsString, RESTAPI_VERSION } from '../utils';
35+
import { LisaChatMessage, LisaChatMessageMetadata, LisaChatSession } from '../types';
36+
import { formatDocumentsAsString, RESTAPI_URI, RESTAPI_VERSION } from '../utils';
3037
import { LisaChatMessageHistory } from '../adapters/lisa-chat-history';
3138
import { ChatPromptTemplate, MessagesPlaceholder, PromptTemplate } from '@langchain/core/prompts';
3239
import { RunnableSequence } from '@langchain/core/runnables';
3340
import { StringOutputParser } from '@langchain/core/output_parsers';
34-
import { BufferWindowMemory } from 'langchain/memory';
3541
import RagControls, { RagConfig } from './RagOptions';
3642
import { ContextUploadModal, RagUploadModal } from './FileUploadModals';
3743
import { ChatOpenAI } from '@langchain/openai';
@@ -41,7 +47,7 @@ import { useLazyGetConfigurationQuery } from '../../shared/reducers/configuratio
4147
import {
4248
useGetSessionHealthQuery,
4349
useLazyGetSessionByIdQuery,
44-
useUpdateSessionMutation
50+
useUpdateSessionMutation,
4551
} from '../../shared/reducers/session.reducer';
4652
import { useAppDispatch } from '../../config/store';
4753
import { useNotificationService } from '../../shared/util/hooks';
@@ -51,6 +57,7 @@ import { baseConfig, GenerateLLMRequestParams, IChatConfiguration } from '../../
5157
import { useLazyGetRelevantDocumentsQuery } from '../../shared/reducers/rag.reducer';
5258
import { IConfiguration } from '../../shared/model/configuration.model';
5359
import { DocumentSummarizationModal } from './DocumentSummarizationModal';
60+
import { ChatMemory } from '../../shared/util/chat-memory';
5461

5562
export default function Chat ({ sessionId }) {
5663
const dispatch = useAppDispatch();
@@ -94,7 +101,7 @@ export default function Chat ({ sessionId }) {
94101
const [useRag, setUseRag] = useState(false);
95102
const [ragConfig, setRagConfig] = useState<RagConfig>({} as RagConfig);
96103
const [memory, setMemory] = useState(
97-
new BufferWindowMemory({
104+
new ChatMemory({
98105
chatHistory: new LisaChatMessageHistory(session),
99106
returnMessages: false,
100107
memoryKey: 'history',
@@ -157,12 +164,11 @@ export default function Chat ({ sessionId }) {
157164
const handleRagConfiguration = async (chainSteps: any[]) => {
158165
const ragStep = {
159166
input: ({ input }: { input: string }) => input,
160-
chatHistory: () => memory.loadMemoryVariables({}),
167+
chatHistory: () => memory.loadMemoryVariables(),
161168
context: async (input: { input: string; chatHistory?: LisaChatMessage[] }) => {
162169
const question = await getContextualizedQuestion(input);
163170
const relevantDocs = await fetchRelevantDocuments(question);
164-
const serialized = await updateSessionWithRagContext(relevantDocs);
165-
return serialized;
171+
return await updateSessionWithRagContext(relevantDocs);
166172
},
167173
};
168174

@@ -218,7 +224,7 @@ export default function Chat ({ sessionId }) {
218224
const handleNonRagConfiguration = (chainSteps: any[]) => {
219225
const nonRagStep = {
220226
input: (initialInput: any) => initialInput.input,
221-
memory: () => memory.loadMemoryVariables({}),
227+
memory: () => memory.loadMemoryVariables(),
222228
context: () => fileContext || '',
223229
humanPrefix: (initialInput: any) => initialInput.humanPrefix,
224230
aiPrefix: (initialInput: any) => initialInput.aiPrefix,
@@ -376,7 +382,7 @@ export default function Chat ({ sessionId }) {
376382

377383
useEffect(() => {
378384
setMemory(
379-
new BufferWindowMemory({
385+
new ChatMemory({
380386
chatHistory: new LisaChatMessageHistory(session),
381387
returnMessages: false,
382388
memoryKey: 'history',
@@ -390,7 +396,7 @@ export default function Chat ({ sessionId }) {
390396

391397
useEffect(() => {
392398
if (selectedModel && auth.isAuthenticated) {
393-
memory.loadMemoryVariables({}).then(async (formattedHistory) => {
399+
memory.loadMemoryVariables().then(async (formattedHistory) => {
394400
const promptValues = {
395401
input: userPrompt,
396402
history: formattedHistory.history,
@@ -543,9 +549,9 @@ export default function Chat ({ sessionId }) {
543549
<div ref={bottomRef} />
544550
</SpaceBetween>
545551
</div>
546-
<div className='fixed bottom-8' style={{width: 'calc(var(--awsui-layout-width-g964ok) - 500px)'}}>
552+
<div className='sticky bottom-8'>
547553
<form onSubmit={(e) => e.preventDefault()}>
548-
<Form variant='embedded'>
554+
<Form>
549555
<Container>
550556
<SpaceBetween size='m' direction='vertical'>
551557
<Grid
@@ -562,6 +568,7 @@ export default function Chat ({ sessionId }) {
562568
empty={<div className='text-gray-500'>No models available.</div>}
563569
filteringType='auto'
564570
value={selectedModel?.modelId ?? ''}
571+
enteredTextLabel={(text) => `Use: "${text}"`}
565572
onChange={({ detail: { value } }) => {
566573
if (!value || value.length === 0) {
567574
setSelectedModel(undefined);
@@ -635,20 +642,20 @@ export default function Chat ({ sessionId }) {
635642
id: 'upload-to-rag',
636643
iconName: 'upload',
637644
text: 'Upload to RAG'
638-
}] : []),
645+
}] as ButtonGroupProps.Item[] : []),
639646
...(config?.configuration.enabledComponents.uploadContextDocs ?
640647
[{
641648
type: 'icon-button',
642649
id: 'add-file-to-context',
643650
iconName: 'insert-row',
644651
text: 'Add file to context'
645-
}] : []),
652+
}] as ButtonGroupProps.Item[] : []),
646653
...(config?.configuration.enabledComponents.documentSummarization ? [{
647654
type: 'icon-button',
648655
id: 'summarize-document',
649656
iconName: 'transcript',
650657
text: 'Summarize Document'
651-
}] : []),
658+
}] as ButtonGroupProps.Item[] : []),
652659
...(config?.configuration.enabledComponents.editPromptTemplate ?
653660
[{
654661
type: 'menu-dropdown',
@@ -661,7 +668,7 @@ export default function Chat ({ sessionId }) {
661668
text: 'Edit Prompt Template'
662669
},
663670
]
664-
}] : [])
671+
}] as ButtonGroupProps.Item[] : [])
665672
]}
666673
variant='icon'
667674
/>

lib/user-interface/react/src/components/chatbot/DocumentSummarizationModal.tsx

+10-6
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@
1515
*/
1616

1717
import {
18-
Modal,
18+
Autosuggest,
1919
Box,
20-
SpaceBetween,
2120
Button,
21+
FileUpload,
22+
Modal,
23+
SpaceBetween,
24+
Textarea,
2225
TextContent,
23-
FileUpload, Autosuggest, Textarea,
2426
} from '@cloudscape-design/components';
2527
import { FileTypes, LisaChatSession } from '../types';
2628
import { useEffect, useMemo, useState } from 'react';
@@ -32,9 +34,9 @@ import { handleUpload } from './FileUploadModals';
3234
import { IChatConfiguration } from '../../shared/model/chat.configurations.model';
3335
import { v4 as uuidv4 } from 'uuid';
3436
import FormField from '@cloudscape-design/components/form-field';
35-
import { BufferWindowMemory } from 'langchain/memory';
3637
import { LisaChatMessageHistory } from '../adapters/lisa-chat-history';
3738
import Toggle from '@cloudscape-design/components/toggle';
39+
import { ChatMemory } from '../../shared/util/chat-memory';
3840

3941
export type DocumentSummarizationModalProps = {
4042
showDocumentSummarizationModal: boolean;
@@ -51,7 +53,7 @@ export type DocumentSummarizationModalProps = {
5153
setSession: (state: LisaChatSession) => void;
5254
userName: string;
5355
handleSendGenerateRequest: () => void;
54-
setMemory: (state: BufferWindowMemory) => void;
56+
setMemory: (state: ChatMemory) => void;
5557
};
5658

5759
export function DocumentSummarizationModal ({
@@ -163,7 +165,7 @@ export function DocumentSummarizationModal ({
163165
};
164166
setSession(newSession);
165167

166-
setMemory(new BufferWindowMemory({
168+
setMemory(new ChatMemory({
167169
chatHistory: new LisaChatMessageHistory(newSession),
168170
returnMessages: false,
169171
memoryKey: 'history',
@@ -220,6 +222,7 @@ export function DocumentSummarizationModal ({
220222
empty={<div className='text-gray-500'>No models available.</div>}
221223
filteringType='auto'
222224
value={selectedModel?.modelId ?? ''}
225+
enteredTextLabel={(text) => `Use: "${text}"`}
223226
onChange={({ detail: { value } }) => {
224227
if (!value || value.length === 0) {
225228
setSelectedModel(undefined);
@@ -243,6 +246,7 @@ export function DocumentSummarizationModal ({
243246
placeholder='Select prompt type'
244247
filteringType='auto'
245248
value={selectedPromptType}
249+
enteredTextLabel={(text) => `Use: "${text}"`}
246250
onChange={({ detail: { value } }) => {
247251
setUserPrompt('');
248252
if (value && value.length !== 0) {

lib/user-interface/react/src/components/chatbot/RagOptions.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export default function RagControls ({isRunning, setUseRag, setRagConfig }: RagC
6767
empty={<div className='text-gray-500'>No repositories available.</div>}
6868
filteringType='auto'
6969
value={selectedRepositoryOption ?? ''}
70+
enteredTextLabel={(text) => `Use: "${text}"`}
7071
onChange={({ detail }) => {
7172
setSelectedRepositoryOption(detail.value);
7273
setRagConfig((config) => ({
@@ -85,6 +86,7 @@ export default function RagControls ({isRunning, setUseRag, setRagConfig }: RagC
8586
empty={<div className='text-gray-500'>No embedding models available.</div>}
8687
filteringType='auto'
8788
value={selectedEmbeddingOption ?? ''}
89+
enteredTextLabel={(text) => `Use: "${text}"`}
8890
onChange={({ detail }) => {
8991
setSelectedEmbeddingOption(detail.value);
9092

0 commit comments

Comments
 (0)