docs: update documentation and add server schema
- Update CLAUDE.md with server provisioning docs - Add server tables to schema.sql (cloud_providers, instance_specs, etc.) - Register manage_server tool in tools/index.ts - Minor fixes to conversation-service and summary-service Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import { weatherTool, executeWeather } from './weather-tool';
|
||||
import { searchWebTool, lookupDocsTool, executeSearchWeb, executeLookupDocs } from './search-tool';
|
||||
import { manageDomainTool, suggestDomainsTool, executeManageDomain, executeSuggestDomains } from './domain-tool';
|
||||
import { manageDepositTool, executeManageDeposit } from './deposit-tool';
|
||||
import { manageServerTool, executeManageServer } from './server-tool';
|
||||
import { getCurrentTimeTool, calculateTool, executeGetCurrentTime, executeCalculate } from './utility-tools';
|
||||
import type { Env } from '../types';
|
||||
|
||||
@@ -54,6 +55,21 @@ const SuggestDomainsArgsSchema = z.object({
|
||||
keywords: z.string().min(1).max(500),
|
||||
});
|
||||
|
||||
const ManageServerArgsSchema = z.object({
|
||||
action: z.enum(['recommend', 'list_specs', 'order', 'my_servers', 'server_info', 'cancel_order']),
|
||||
purpose: z.string().max(500).optional(),
|
||||
budget: z.number().positive().max(100000000).optional(),
|
||||
spec_id: z.number().int().positive().optional(),
|
||||
order_id: z.number().int().positive().optional(),
|
||||
region: z.string().max(50).optional(),
|
||||
label: z.string().max(100).optional(),
|
||||
provider: z.enum(['linode', 'vultr']).optional(),
|
||||
expected_users: z.number().int().positive().max(1000000).optional(),
|
||||
daily_traffic: z.number().int().positive().max(100000000).optional(),
|
||||
storage_needs_gb: z.number().positive().max(10000).optional(),
|
||||
tech_stack: z.string().max(200).optional(),
|
||||
});
|
||||
|
||||
// All tools array (used by OpenAI API)
|
||||
export const tools = [
|
||||
weatherTool,
|
||||
@@ -63,6 +79,7 @@ export const tools = [
|
||||
lookupDocsTool,
|
||||
manageDomainTool,
|
||||
manageDepositTool,
|
||||
manageServerTool,
|
||||
suggestDomainsTool,
|
||||
];
|
||||
|
||||
@@ -70,6 +87,7 @@ export const tools = [
|
||||
export const TOOL_CATEGORIES: Record<string, string[]> = {
|
||||
domain: [manageDomainTool.function.name, suggestDomainsTool.function.name],
|
||||
deposit: [manageDepositTool.function.name],
|
||||
server: [manageServerTool.function.name],
|
||||
weather: [weatherTool.function.name],
|
||||
search: [searchWebTool.function.name, lookupDocsTool.function.name],
|
||||
utility: [getCurrentTimeTool.function.name, calculateTool.function.name],
|
||||
@@ -79,6 +97,7 @@ export const TOOL_CATEGORIES: Record<string, string[]> = {
|
||||
export const CATEGORY_PATTERNS: Record<string, RegExp> = {
|
||||
domain: /도메인|네임서버|whois|dns|tld|등록|\.com|\.net|\.io|\.kr|\.org/i,
|
||||
deposit: /입금|충전|잔액|계좌|예치금|송금|돈/i,
|
||||
server: /서버|VPS|호스팅|클라우드|리눅스|우분투|인스턴스|가상서버|Linode|Vultr|VM/i,
|
||||
weather: /날씨|기온|비|눈|맑|흐림|더워|추워/i,
|
||||
search: /검색|찾아|뭐야|뉴스|최신/i,
|
||||
};
|
||||
@@ -196,6 +215,15 @@ export async function executeTool(
|
||||
return executeManageDeposit(result.data, env, telegramUserId, db);
|
||||
}
|
||||
|
||||
case 'manage_server': {
|
||||
const result = ManageServerArgsSchema.safeParse(args);
|
||||
if (!result.success) {
|
||||
logger.error('Invalid server args', new Error(result.error.message), { args });
|
||||
return `❌ Invalid arguments: ${result.error.issues.map(e => e.message).join(', ')}`;
|
||||
}
|
||||
return executeManageServer(result.data, env, telegramUserId, db, env?.CLOUD_DB);
|
||||
}
|
||||
|
||||
default:
|
||||
return `알 수 없는 도구: ${name}`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user