fix: clear cached web search and knowledge references in BaseApiClient (#7759)

This commit is contained in:
亢奋猫 2025-07-02 20:51:47 +08:00 committed by GitHub
parent fb624cc368
commit 575d6fa91b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 4 additions and 2 deletions

View File

@ -210,6 +210,7 @@ export abstract class BaseApiClient<
public async getMessageContent(message: Message): Promise<string> {
const content = getContentWithTools(message)
if (isEmpty(content)) {
return ''
}
@ -273,6 +274,7 @@ export abstract class BaseApiClient<
const webSearch: WebSearchResponse = window.keyv.get(`web-search-${message.id}`)
if (webSearch) {
window.keyv.remove(`web-search-${message.id}`)
return (webSearch.results as WebSearchProviderResponse).results.map(
(result, index) =>
({
@ -298,6 +300,7 @@ export abstract class BaseApiClient<
const knowledgeReferences: KnowledgeReference[] = window.keyv.get(`knowledge-search-${message.id}`)
if (!isEmpty(knowledgeReferences)) {
window.keyv.remove(`knowledge-search-${message.id}`)
// Logger.log(`Found ${knowledgeReferences.length} knowledge base references in cache for ID: ${message.id}`)
return knowledgeReferences
}

View File

@ -87,7 +87,7 @@ const CitationsList: React.FC<CitationsListProps> = ({ citations }) => {
</div>
}
placement="right"
trigger="hover"
trigger="click"
styles={{
body: {
padding: '0 0 8px 0'
@ -184,7 +184,6 @@ const KnowledgeCitation: React.FC<{ citation: Citation }> = ({ citation }) => {
<CitationLink className="text-nowrap" href={citation.url} onClick={(e) => handleLinkClick(citation.url, e)}>
{citation.title}
</CitationLink>
<CitationIndex>{citation.number}</CitationIndex>
{citation.content && <CopyButton content={citation.content} />}
</WebSearchCardHeader>