ui: add browser get_info tool (#27251)
* ui: add browser get_info tool * format * nits * Update tools/ui/src/lib/stores/tools.svelte.ts Co-authored-by: Aleksander Grygier <aleksander.grygier@gmail.com> --------- Co-authored-by: Aleksander Grygier <aleksander.grygier@gmail.com>
This commit is contained in:
co-authored by
Aleksander Grygier
parent
d83f72d463
commit
7077abbe14
@@ -56,7 +56,8 @@ import type {
|
||||
AgenticSession,
|
||||
McpServerOverride,
|
||||
MCPToolCall,
|
||||
SettingsConfigType
|
||||
SettingsConfigType,
|
||||
ToolExecutionResult
|
||||
} from '$lib/types';
|
||||
import type {
|
||||
AgenticFlowCallbacks,
|
||||
@@ -83,7 +84,7 @@ import type {
|
||||
DatabaseMessageExtraAudioFile,
|
||||
DatabaseMessageExtraImageFile
|
||||
} from '$lib/types/database';
|
||||
import { getAudioInputFormat, isAbortError } from '$lib/utils';
|
||||
import { executeBrowserInfoTool, getAudioInputFormat, isAbortError } from '$lib/utils';
|
||||
import { SvelteMap } from 'svelte/reactivity';
|
||||
|
||||
function createDefaultSession(): AgenticSession {
|
||||
@@ -942,18 +943,24 @@ class AgenticStore {
|
||||
if (executionResult.isError) toolSuccess = false;
|
||||
} else if (toolSource === ToolSource.FRONTEND) {
|
||||
const args = this.parseToolArguments(toolCall.function.arguments);
|
||||
const executionResult =
|
||||
toolName === BuiltInTool.READ_MEDIA
|
||||
? await ReadMediaService.executeTool(
|
||||
args,
|
||||
{
|
||||
audio: modelsStore.modelSupportsAudio(effectiveModel),
|
||||
vision: modelsStore.modelSupportsVision(effectiveModel)
|
||||
},
|
||||
signal,
|
||||
conversationsStore.activeConversation?.cwd
|
||||
)
|
||||
: await SandboxService.executeTool(toolName, args, signal);
|
||||
|
||||
let executionResult: ToolExecutionResult;
|
||||
|
||||
if (toolName === BuiltInTool.GET_INFO) {
|
||||
executionResult = executeBrowserInfoTool();
|
||||
} else if (toolName === BuiltInTool.READ_MEDIA) {
|
||||
executionResult = await ReadMediaService.executeTool(
|
||||
args,
|
||||
{
|
||||
audio: modelsStore.modelSupportsAudio(effectiveModel),
|
||||
vision: modelsStore.modelSupportsVision(effectiveModel)
|
||||
},
|
||||
signal,
|
||||
conversationsStore.activeConversation?.cwd
|
||||
);
|
||||
} else {
|
||||
executionResult = await SandboxService.executeTool(toolName, args, signal);
|
||||
}
|
||||
|
||||
result = executionResult.content;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user