update search result in prompt

This commit is contained in:
CaiHQ 2025-02-15 13:02:24 +08:00
parent a56e46a98d
commit 51188b1428
3 changed files with 16 additions and 12 deletions

View File

@ -38,7 +38,7 @@
}
},
"copyToClipboard": "复制到剪贴板",
"webSearch": "搜索万维网",
"webSearch": "正在搜索",
"iodSearch": "搜索数联网",
"regenerate": "重新生成",
"edit": "编辑",

View File

@ -294,6 +294,7 @@ export const useMessageOption = () => {
webSearch,
iodSearch,
)
console.log("prompt:\n"+prompt);
setIsSearchingInternet(false)
// message = message.trim().replaceAll("\n", " ")

View File

@ -85,19 +85,22 @@ export const getSystemPromptForWeb = async (
// )
// .join("\n")
}
const search_results = iodSearchResults.map((res) => ({
const iod_search_results = iodSearchResults.map((res) => ({
url: `${res.doId}: ${res.name}`,
content: res.description
}))
.concat(
webSearchResults
)
.map(
(result, idx) =>
`<result source="${result.url}" id="${idx}">${result.content}</result>`
)
.join("\n")
})).map(
(result, idx) =>
`<result source="${result.url}" id="${idx}">${result.content}</result>`
)
.join("\n");
console.log("iod_search_result:"+iod_search_results);
const web_search_results = webSearchResults.map(
(result, idx) =>
`<result source="${result.url}" id="${idx}">${result.content}</result>`
)
.join("\n");
const search_results = (iodSearch?"<数联网搜索结果>"+iod_search_results+"</数联网搜索结果>":"")
+ (webSearch?"<万维网搜索结果>"+web_search_results+"</万维网搜索结果>":"");
const current_date_time = new Date().toLocaleString()