现在会话输入框会记住用户的配置选项和模型选择,避免每次都要重新勾选
This commit is contained in:
@@ -47,6 +47,10 @@ import {
|
||||
type MessageTurn,
|
||||
type PromptDraft,
|
||||
} from "@/lib/types"
|
||||
import {
|
||||
getSavedModeId,
|
||||
saveModePreference,
|
||||
} from "@/lib/selector-prefs-storage"
|
||||
import {
|
||||
buildConversationDraftStorageKey,
|
||||
buildNewConversationDraftStorageKey,
|
||||
@@ -724,7 +728,7 @@ const ConversationTabView = memo(function ConversationTabView({
|
||||
if (dbConvIdRef.current) return
|
||||
|
||||
setDraftAgentType(nextAgentType)
|
||||
setModeId(null)
|
||||
setModeId(getSavedModeId(nextAgentType))
|
||||
setAgentConnectError(null)
|
||||
|
||||
const s = connStatusRef.current
|
||||
@@ -759,6 +763,20 @@ const ConversationTabView = memo(function ConversationTabView({
|
||||
[connConnect, connDisconnect, workingDirForConnection]
|
||||
)
|
||||
|
||||
const handleModeChange = useCallback(
|
||||
(newModeId: string) => {
|
||||
setModeId(newModeId)
|
||||
// Persist mode selection to localStorage immediately
|
||||
if (conn.modes) {
|
||||
saveModePreference(selectedAgent, {
|
||||
...conn.modes,
|
||||
current_mode_id: newModeId,
|
||||
})
|
||||
}
|
||||
},
|
||||
[conn.modes, selectedAgent]
|
||||
)
|
||||
|
||||
const handleAnswerQuestion = useCallback(
|
||||
(answer: string) => {
|
||||
if (connStatus !== "connected") return
|
||||
@@ -853,7 +871,7 @@ const ConversationTabView = memo(function ConversationTabView({
|
||||
configOptionsLoading={configOptionsLoading}
|
||||
selectorsLoading={selectorsLoading}
|
||||
selectedModeId={selectedModeId}
|
||||
onModeChange={setModeId}
|
||||
onModeChange={handleModeChange}
|
||||
onConfigOptionChange={handleSetConfigOption}
|
||||
availableCommands={connectionCommands}
|
||||
attachmentTabId={tabId}
|
||||
@@ -924,7 +942,7 @@ const ConversationTabView = memo(function ConversationTabView({
|
||||
configOptionsLoading={configOptionsLoading}
|
||||
selectorsLoading={selectorsLoading}
|
||||
selectedModeId={selectedModeId}
|
||||
onModeChange={setModeId}
|
||||
onModeChange={handleModeChange}
|
||||
onConfigOptionChange={handleSetConfigOption}
|
||||
availableCommands={connectionCommands}
|
||||
attachmentTabId={tabId}
|
||||
|
||||
Reference in New Issue
Block a user