chore: tool type

This commit is contained in:
Louis 2025-03-31 19:41:15 +07:00
parent 72a7157509
commit cc90c1e86e
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2
2 changed files with 9 additions and 2 deletions

View File

@ -58,6 +58,7 @@ import {
updateThreadAtom, updateThreadAtom,
updateThreadWaitingForResponseAtom, updateThreadWaitingForResponseAtom,
} from '@/helpers/atoms/Thread.atom' } from '@/helpers/atoms/Thread.atom'
import { ModelTool } from '@/types/model'
export const reloadModelAtom = atom(false) export const reloadModelAtom = atom(false)
@ -185,7 +186,7 @@ export default function useSendChatMessage() {
}, },
activeThreadRef.current, activeThreadRef.current,
messages ?? currentMessages, messages ?? currentMessages,
(await window.core.api.getTools())?.map((tool) => ({ (await window.core.api.getTools())?.map((tool: ModelTool) => ({
type: 'function' as const, type: 'function' as const,
function: { function: {
name: tool.name, name: tool.name,
@ -311,7 +312,7 @@ export default function useSendChatMessage() {
{ {
type: ContentType.Text, type: ContentType.Text,
text: { text: {
value: `<think>Executing Tool ${toolCall.function.name} with arguments ${toolCall.function.arguments}</think>`, value: `<think>Executing Tool ${toolCall.function.name} with arguments ${toolCall.function.arguments}`,
annotations: [], annotations: [],
}, },
}, },

View File

@ -2,3 +2,9 @@
* ModelParams types * ModelParams types
*/ */
export type ModelParams = ModelRuntimeParams | ModelSettingParams export type ModelParams = ModelRuntimeParams | ModelSettingParams
export type ModelTool = {
name: string
description: string
inputSchema: string
}