update iod search

This commit is contained in:
CaiHQ
2025-03-24 13:21:49 +08:00
parent 3cbf4454da
commit 3fb66b4c36
3 changed files with 137 additions and 13 deletions

View File

@@ -2,7 +2,7 @@ import { saveHistory, saveMessage } from "@/db"
import { setLastUsedChatModel, setLastUsedChatSystemPrompt } from "@/services/model-settings"
import { generateTitle } from "@/services/title"
import { ChatHistory } from "@/store/option"
import { updateDialog } from "@/web/iod"
export const saveMessageOnError = async ({
e,
history,
@@ -154,6 +154,7 @@ export const saveMessageOnSuccess = async ({
prompt_content?: string
reasoning_time_taken?: number
}) => {
var botMessage;
if (historyId) {
if (!isRegenerate) {
await saveMessage(
@@ -170,7 +171,7 @@ export const saveMessageOnSuccess = async ({
reasoning_time_taken
)
}
await saveMessage(
botMessage = await saveMessage(
historyId,
selectedModel!,
"assistant",
@@ -183,6 +184,7 @@ export const saveMessageOnSuccess = async ({
generationInfo,
reasoning_time_taken
)
updateDialog(historyId, botMessage)
await setLastUsedChatModel(historyId, selectedModel!)
if (prompt_id || prompt_content) {
await setLastUsedChatSystemPrompt(historyId, { prompt_content, prompt_id })
@@ -203,7 +205,7 @@ export const saveMessageOnSuccess = async ({
generationInfo,
reasoning_time_taken
)
await saveMessage(
botMessage = await saveMessage(
newHistoryId.id,
selectedModel!,
"assistant",
@@ -216,6 +218,7 @@ export const saveMessageOnSuccess = async ({
generationInfo,
reasoning_time_taken
)
updateDialog(newHistoryId.id, botMessage)
setHistoryId(newHistoryId.id)
await setLastUsedChatModel(newHistoryId.id, selectedModel!)
if (prompt_id || prompt_content) {

View File

@@ -314,6 +314,9 @@ export const useMessageOption = () => {
res = removeReasoning(res)
keywords = res
.replace(/^Keywords:/i, "")
.replace(/^关键词:/i, "")
.replace(/^/i, "")
.replace(/^:/i, "")
.split(", ")
.map((k) => k.trim())
}