diff --git a/src/renderer/src/pages/home/Inputbar/AgentSessionInputbar.tsx b/src/renderer/src/pages/home/Inputbar/AgentSessionInputbar.tsx index 2dbcd04067..2111822641 100644 --- a/src/renderer/src/pages/home/Inputbar/AgentSessionInputbar.tsx +++ b/src/renderer/src/pages/home/Inputbar/AgentSessionInputbar.tsx @@ -1,3 +1,4 @@ +import { cacheService } from '@data/CacheService' import { loggerService } from '@logger' import type { QuickPanelTriggerInfo } from '@renderer/components/QuickPanel' import { QuickPanelReservedSymbol, useQuickPanel } from '@renderer/components/QuickPanel' @@ -9,7 +10,6 @@ import { getModel } from '@renderer/hooks/useModel' import { useSettings } from '@renderer/hooks/useSettings' import { useTextareaResize } from '@renderer/hooks/useTextareaResize' import { useTimer } from '@renderer/hooks/useTimer' -import { CacheService } from '@renderer/services/CacheService' import { pauseTrace } from '@renderer/services/SpanManagerService' import { estimateUserPromptUsage } from '@renderer/services/TokenService' import { useAppDispatch, useAppSelector } from '@renderer/store' @@ -169,8 +169,8 @@ const AgentSessionInputbarInner: FC = ({ assistant, agentId, session setText, isEmpty: inputEmpty } = useInputText({ - initialValue: CacheService.get(draftCacheKey) ?? '', - onChange: (value) => CacheService.set(draftCacheKey, value, DRAFT_CACHE_TTL) + initialValue: cacheService.get(draftCacheKey) ?? '', + onChange: (value) => cacheService.set(draftCacheKey, value, DRAFT_CACHE_TTL) }) const { textareaRef, diff --git a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx index e029599d05..9cd4077caa 100644 --- a/src/renderer/src/pages/home/Inputbar/Inputbar.tsx +++ b/src/renderer/src/pages/home/Inputbar/Inputbar.tsx @@ -1,3 +1,4 @@ +import { cacheService } from '@data/CacheService' import { usePreference } from '@data/hooks/usePreference' import { loggerService } from '@logger' import { @@ -23,7 +24,6 @@ import { useInputbarToolsState } from '@renderer/pages/home/Inputbar/context/InputbarToolsProvider' import { getDefaultTopic } from '@renderer/services/AssistantService' -import { CacheService } from '@renderer/services/CacheService' import { EVENT_NAMES, EventEmitter } from '@renderer/services/EventService' import FileManager from '@renderer/services/FileManager' import { checkRateLimit, getUserMessage } from '@renderer/services/MessagesService' @@ -57,7 +57,7 @@ const DRAFT_CACHE_TTL = 24 * 60 * 60 * 1000 // 24 hours const getMentionedModelsCacheKey = (assistantId: string) => `inputbar-mentioned-models-${assistantId}` const getValidatedCachedModels = (assistantId: string): Model[] => { - const cached = CacheService.get(getMentionedModelsCacheKey(assistantId)) + const cached = cacheService.get(getMentionedModelsCacheKey(assistantId)) if (!Array.isArray(cached)) return [] return cached.filter((model) => model?.id && model?.name) } @@ -135,8 +135,8 @@ const InputbarInner: FC = ({ assistant: initialAssistant, se const { setCouldAddImageFile } = useInputbarToolsInternalDispatch() const { text, setText } = useInputText({ - initialValue: CacheService.get(INPUTBAR_DRAFT_CACHE_KEY) ?? '', - onChange: (value) => CacheService.set(INPUTBAR_DRAFT_CACHE_KEY, value, DRAFT_CACHE_TTL) + initialValue: cacheService.get(INPUTBAR_DRAFT_CACHE_KEY) ?? '', + onChange: (value) => cacheService.set(INPUTBAR_DRAFT_CACHE_KEY, value, DRAFT_CACHE_TTL) }) const { textareaRef, @@ -208,7 +208,7 @@ const InputbarInner: FC = ({ assistant: initialAssistant, se }, [canAddImageFile, setCouldAddImageFile]) const onUnmount = useEffectEvent((id: string) => { - CacheService.set(getMentionedModelsCacheKey(id), mentionedModels, DRAFT_CACHE_TTL) + cacheService.set(getMentionedModelsCacheKey(id), mentionedModels, DRAFT_CACHE_TTL) }) useEffect(() => {