Files
smart-home-tablet/lib/tools/transport.ts
Cosmo 7b5f76576f
All checks were successful
Deploy / deploy (push) Successful in 1m25s
refactor: tool plugin registry - each tool in separate file
2026-04-30 20:58:11 +00:00

39 lines
1.4 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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)
},
}