39 lines
1.4 KiB
TypeScript
39 lines
1.4 KiB
TypeScript
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)
|
||
},
|
||
}
|