mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-07 09:21:24 +08:00
fix(core): ai tool calling explanation (#13097)
Close [AI-293](https://linear.app/affine-design/issue/AI-293) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Tool call cards for website reading now display the specific URL being accessed. * Tool call cards for web searches now display the search query being used. * **Style** * Updated tool call instructions to prevent explanations of operations before execution. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -1675,6 +1675,7 @@ This sentence contains information from the first source[^1]. This sentence refe
|
|||||||
|
|
||||||
<tool-calling-guidelines>
|
<tool-calling-guidelines>
|
||||||
Before starting Tool calling, you need to follow:
|
Before starting Tool calling, you need to follow:
|
||||||
|
- DO NOT explain what operation you will perform.
|
||||||
- DO NOT embed a tool call mid-sentence.
|
- DO NOT embed a tool call mid-sentence.
|
||||||
- When searching for unknown information or keyword, prioritize searching the user's workspace.
|
- When searching for unknown information or keyword, prioritize searching the user's workspace.
|
||||||
- Depending on the complexity of the question and the information returned by the search tools, you can call different tools multiple times to search.
|
- Depending on the complexity of the question and the information returned by the search tools, you can call different tools multiple times to search.
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ export class WebCrawlTool extends WithDisposable(ShadowlessElement) {
|
|||||||
renderToolCall() {
|
renderToolCall() {
|
||||||
return html`
|
return html`
|
||||||
<tool-call-card
|
<tool-call-card
|
||||||
.name=${'Reading the website'}
|
.name=${`Reading the website "${this.data.args.url}"`}
|
||||||
.icon=${WebIcon()}
|
.icon=${WebIcon()}
|
||||||
></tool-call-card>
|
></tool-call-card>
|
||||||
`;
|
`;
|
||||||
|
|||||||
@@ -12,14 +12,14 @@ interface WebSearchToolCall {
|
|||||||
type: 'tool-call';
|
type: 'tool-call';
|
||||||
toolCallId: string;
|
toolCallId: string;
|
||||||
toolName: string;
|
toolName: string;
|
||||||
args: { url: string };
|
args: { query: string };
|
||||||
}
|
}
|
||||||
|
|
||||||
interface WebSearchToolResult {
|
interface WebSearchToolResult {
|
||||||
type: 'tool-result';
|
type: 'tool-result';
|
||||||
toolCallId: string;
|
toolCallId: string;
|
||||||
toolName: string;
|
toolName: string;
|
||||||
args: { url: string };
|
args: { query: string };
|
||||||
result:
|
result:
|
||||||
| Array<{
|
| Array<{
|
||||||
title: string;
|
title: string;
|
||||||
@@ -46,7 +46,7 @@ export class WebSearchTool extends WithDisposable(ShadowlessElement) {
|
|||||||
renderToolCall() {
|
renderToolCall() {
|
||||||
return html`
|
return html`
|
||||||
<tool-call-card
|
<tool-call-card
|
||||||
.name=${'Search from web'}
|
.name=${`Searching the web for "${this.data.args.query}"`}
|
||||||
.icon=${WebIcon()}
|
.icon=${WebIcon()}
|
||||||
></tool-call-card>
|
></tool-call-card>
|
||||||
`;
|
`;
|
||||||
|
|||||||
Reference in New Issue
Block a user