|
|
|
|
@@ -51,10 +51,10 @@ import TokenCount from './TokenCount'
|
|
|
|
|
|
|
|
|
|
const logger = loggerService.withContext('Inputbar')
|
|
|
|
|
|
|
|
|
|
const INPUTBAR_DRAFT_CACHE_KEY = 'inputbar-draft'
|
|
|
|
|
const INPUTBAR_DRAFT_CACHE_KEY = 'inputbar.draft.text'
|
|
|
|
|
const DRAFT_CACHE_TTL = 24 * 60 * 60 * 1000 // 24 hours
|
|
|
|
|
|
|
|
|
|
const getMentionedModelsCacheKey = (assistantId: string) => `inputbar-mentioned-models-${assistantId}`
|
|
|
|
|
const getMentionedModelsCacheKey = (assistantId: string) => `inputbar.mentioned.models.${assistantId}`
|
|
|
|
|
|
|
|
|
|
const getValidatedCachedModels = (assistantId: string): Model[] => {
|
|
|
|
|
const cached = cacheService.get<Model[]>(getMentionedModelsCacheKey(assistantId))
|
|
|
|
|
@@ -134,6 +134,10 @@ const InputbarInner: FC<InputbarInnerProps> = ({ assistant: initialAssistant, se
|
|
|
|
|
const { setFiles, setMentionedModels, setSelectedKnowledgeBases } = useInputbarToolsDispatch()
|
|
|
|
|
const { setCouldAddImageFile } = useInputbarToolsInternalDispatch()
|
|
|
|
|
|
|
|
|
|
const { text, setText } = useInputText({
|
|
|
|
|
initialValue: cacheService.get<string>(INPUTBAR_DRAFT_CACHE_KEY) ?? '',
|
|
|
|
|
onChange: (value) => cacheService.set(INPUTBAR_DRAFT_CACHE_KEY, value, DRAFT_CACHE_TTL)
|
|
|
|
|
})
|
|
|
|
|
const { text, setText } = useInputText({
|
|
|
|
|
initialValue: cacheService.get<string>(INPUTBAR_DRAFT_CACHE_KEY) ?? '',
|
|
|
|
|
onChange: (value) => cacheService.set(INPUTBAR_DRAFT_CACHE_KEY, value, DRAFT_CACHE_TTL)
|
|
|
|
|
@@ -213,8 +217,7 @@ const InputbarInner: FC<InputbarInnerProps> = ({ assistant: initialAssistant, se
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
return () => onUnmount(assistant.id)
|
|
|
|
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
|
|
|
}, [assistant.id])
|
|
|
|
|
}, [assistant.id, onUnmount])
|
|
|
|
|
|
|
|
|
|
const placeholderText = enableQuickPanelTriggers
|
|
|
|
|
? t('chat.input.placeholder', { key: getSendMessageShortcutLabel(sendMessageShortcut) })
|
|
|
|
|
|