refactor: tool plugin registry - each tool in separate file
All checks were successful
Deploy / deploy (push) Successful in 1m25s
All checks were successful
Deploy / deploy (push) Successful in 1m25s
This commit is contained in:
38
lib/tools/transport.ts
Normal file
38
lib/tools/transport.ts
Normal 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)
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user