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:
31
lib/tools/weather.ts
Normal file
31
lib/tools/weather.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import type { VoiceTool } from './_types'
|
||||
import { tabletGet } from './_http'
|
||||
|
||||
export const tool: VoiceTool = {
|
||||
schema: {
|
||||
type: 'function',
|
||||
function: {
|
||||
name: 'get_weather',
|
||||
description:
|
||||
'Получить текущую погоду и короткий прогноз для города. ' +
|
||||
'Для вопросов вроде «какая сегодня погода», «холодно ли на улице», «нужен ли зонт». ' +
|
||||
'По умолчанию — Санкт-Петербург.',
|
||||
parameters: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
city: {
|
||||
type: 'string',
|
||||
description:
|
||||
'Город на русском или шорткод (spb, msk, sochi, ekb, kzn, nsk, krd). ' +
|
||||
'По умолчанию Санкт-Петербург.',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
async execute(args) {
|
||||
const city = (args?.city as string) || ''
|
||||
return tabletGet('/api/voice/tools/weather', city ? { city } : undefined)
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user