feat: Integrate with `/tools` endpoint

This commit is contained in:
Aleksander Grygier 2026-03-19 14:03:51 +01:00
parent 8d0eb1aaaf
commit 684ed10a04
3 changed files with 19 additions and 0 deletions

View File

@ -4,5 +4,9 @@ export const API_MODELS = {
UNLOAD: '/models/unload'
};
export const API_TOOLS = {
LIST: '/tools'
};
/** CORS proxy endpoint path */
export const CORS_PROXY_ENDPOINT = '/cors-proxy';

View File

@ -0,0 +1,14 @@
import { apiFetch } from '$lib/utils';
import { API_TOOLS } from '$lib/constants';
import type { OpenAIToolDefinition } from '$lib/types';
export class ToolsService {
/**
* Fetch the list of built-in tools from the server.
*
* @returns Array of tool definitions in OpenAI-compatible format
*/
static async list(): Promise<OpenAIToolDefinition[]> {
return apiFetch<OpenAIToolDefinition[]>(API_TOOLS.LIST);
}
}

View File

@ -161,6 +161,7 @@ export default defineConfig({
'/v1': 'http://localhost:8080',
'/props': 'http://localhost:8080',
'/models': 'http://localhost:8080',
'/tools': 'http://localhost:8080',
'/cors-proxy': 'http://localhost:8080'
},
headers: {