bug fixes, and performance improvements, and drawer
This commit is contained in:
@@ -433,7 +433,21 @@ async function generateResponse(
|
||||
|
||||
if (search) {
|
||||
tools.search = tool({
|
||||
description: 'Searches the web. Choose how many results to return on every call using the required results argument.',
|
||||
description: `Searches the web. Choose how many results to return on every call using the required results argument.
|
||||
|
||||
CITATION FORMAT:
|
||||
Every result includes a sourceId. Cite supporting results immediately after the claim using this exact construction:
|
||||
"[[cite:" + the result's sourceId + "]]"
|
||||
The prefix "cite:" is mandatory literal text. Copy the sourceId unchanged after that prefix. Do not output the word "sourceId" as a placeholder.
|
||||
|
||||
Example: if a result has sourceId "sd625ebbd4d3544e4914f5a51840d7632":
|
||||
CORRECT: The report describes rising prices. [[cite:sd625ebbd4d3544e4914f5a51840d7632]]
|
||||
INCORRECT: The report describes rising prices. [[sd625ebbd4d3544e4914f5a51840d7632]]
|
||||
The incorrect form is missing "cite:" and will not render as a citation.
|
||||
|
||||
For multiple sources, put their exact IDs after a single "cite:" prefix, separated by commas without spaces: [[cite:ID_FROM_FIRST_RESULT,ID_FROM_SECOND_RESULT]]. Replace both placeholders with returned sourceId values. Separate complete citations are also valid: [[cite:ID_FROM_FIRST_RESULT]] [[cite:ID_FROM_SECOND_RESULT]].
|
||||
Use only IDs returned by searches during this response; never invent IDs or copy the example ID unless it actually appears in a result. Write citation markers directly in answer text, not inside backticks or code blocks. Do not repeat URLs or add footnote definitions for these citations.
|
||||
Search snippets are excerpts, not full-page reads.`,
|
||||
inputSchema: searchInputSchema,
|
||||
outputSchema: searchOutputSchema,
|
||||
execute: async ({ query, results }) => {
|
||||
@@ -652,6 +666,7 @@ async function generateResponse(
|
||||
partId: part.id,
|
||||
lastUpdatedAt: new Date(),
|
||||
content: token.text,
|
||||
offset: part.accumulatedContent.length - token.text.length,
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -1244,7 +1259,8 @@ async function generateResponse(
|
||||
}
|
||||
})
|
||||
} finally {
|
||||
topicEvents.clearLiveText(topicId, message.id);
|
||||
completeGeneration(generationId);
|
||||
if (logFile !== undefined) logFile.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user