mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2025-12-29 23:12:38 +08:00
fix: clear cached web search and knowledge references in BaseApiClient (#7759)
This commit is contained in:
parent
fb624cc368
commit
575d6fa91b
@ -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
|
||||
}
|
||||
|
||||
@ -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>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user