🎨 优化预设 && 优化对话是预设和模型切换

Signed-off-by: Echo <1711788888@qq.com>
This commit is contained in:
2026-02-28 15:09:40 +08:00
parent 032d0ccdf0
commit 81b552b689
7 changed files with 113 additions and 50 deletions

View File

@@ -28,6 +28,8 @@ export interface Conversation {
characterId: number
title: string
presetId?: number
worldbookId?: number
worldbookEnabled: boolean
aiProvider: string
model: string
settings?: Record<string, any>
@@ -50,6 +52,8 @@ export interface CreateConversationRequest {
characterId: number
title?: string
presetId?: number
worldbookId?: number
worldbookEnabled?: boolean
aiProvider?: string
model?: string
settings?: Record<string, any>
@@ -103,8 +107,12 @@ export const conversationApi = {
},
// 更新对话设置
updateConversationSettings: (conversationId: number, settings: Record<string, any>) => {
return apiClient.put(`/app/conversation/${conversationId}/settings`, { settings })
updateConversationSettings: (conversationId: number, data: {
settings?: Record<string, any>
worldbookId?: number
worldbookEnabled?: boolean
}) => {
return apiClient.put(`/app/conversation/${conversationId}/settings`, data)
},
// 重新生成最后一条 AI 回复(非流式)

View File

@@ -149,7 +149,7 @@ export default function ChatArea({ conversation, character, onConversationUpdate
} else {
settings.presetId = presetId
}
await conversationApi.updateConversationSettings(conversation.id, settings)
await conversationApi.updateConversationSettings(conversation.id, { settings })
setSelectedPresetId(presetId ?? undefined)
setShowPresetSelector(false)
const convResp = await conversationApi.getConversationById(conversation.id)
@@ -170,7 +170,7 @@ export default function ChatArea({ conversation, character, onConversationUpdate
} else {
settings.aiConfigId = configId
}
await conversationApi.updateConversationSettings(conversation.id, settings)
await conversationApi.updateConversationSettings(conversation.id, { settings })
setSelectedConfigId(configId ?? undefined)
setShowModelSelector(false)
const convResp = await conversationApi.getConversationById(conversation.id)