feat(context optimization):improved context management and redused chat overhead

This commit is contained in:
Anirban Kar
2024-12-07 15:58:13 +05:30
parent 2af32b0333
commit ea5c6244a6
5 changed files with 107 additions and 10 deletions

View File

@@ -91,7 +91,7 @@ export const ChatImpl = memo(
const [chatStarted, setChatStarted] = useState(initialMessages.length > 0);
const [uploadedFiles, setUploadedFiles] = useState<File[]>([]); // Move here
const [imageDataList, setImageDataList] = useState<string[]>([]); // Move here
const files = useStore(workbenchStore.files);
const [model, setModel] = useState(() => {
const savedModel = Cookies.get('selectedModel');
return savedModel || DEFAULT_MODEL;
@@ -111,6 +111,7 @@ export const ChatImpl = memo(
api: '/api/chat',
body: {
apiKeys,
files,
},
onError: (error) => {
logger.error('Request failed\n\n', error);