refactor: tool plugin registry - each tool in separate file
All checks were successful
Deploy / deploy (push) Successful in 1m25s

This commit is contained in:
Cosmo
2026-04-30 20:58:11 +00:00
parent 4ba1aa43d5
commit 7b5f76576f
9 changed files with 465 additions and 2 deletions

38
lib/tools/transport.ts Normal file
View File

@@ -0,0 +1,38 @@
import type { VoiceTool } from './_types'
import { tabletGet } from './_http'
export const tool: VoiceTool = {
schema: {
type: 'function',
function: {
name: 'get_transport',
description:
'Расписание ближайших трамваев на остановке Ул. Антонова-Овсеенко. ' +
'Для вопросов «когда следующий 23-й», «что ближайшее в центр», «пора идти на остановку».',
parameters: {
type: 'object',
properties: {
direction: {
type: 'string',
enum: ['to_center', 'from_center', 'all'],
description:
'to_center = в центр (к Новочеркасской), ' +
'from_center = от центра (к Большевиков), all = оба направления',
},
routes: {
type: 'string',
description:
'Фильтр маршрутов через запятую, например «23» или «23,27». Пусто = все маршруты.',
},
},
},
},
},
async execute(args) {
const q: Record<string, string> = {}
if (args?.direction) q.direction = String(args.direction)
if (args?.routes) q.routes = String(args.routes)
return tabletGet('/api/voice/tools/transport', q)
},
}