feat: recreate Server Agent for premium VM management
Session-based agent with OpenAI Function Calling (9 tools). Follows ddos-agent pattern: execute tools inside loop, feed results back to AI. Includes D1 migration, session routing in openai-service, and doc updates. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,6 +10,7 @@ import { processTroubleshootConsultation, hasTroubleshootSession } from './agent
|
||||
import { processDomainConsultation, hasDomainSession } from './agents/domain-agent';
|
||||
import { processDepositConsultation, hasDepositSession } from './agents/deposit-agent';
|
||||
import { processDdosConsultation, hasDdosSession } from './agents/ddos-agent';
|
||||
import { processServerConsultation, hasServerSession } from './agents/server-agent';
|
||||
|
||||
const logger = createLogger('openai');
|
||||
|
||||
@@ -296,6 +297,29 @@ export async function generateOpenAIResponse(
|
||||
});
|
||||
// Continue with normal flow if session check fails
|
||||
}
|
||||
|
||||
// Check for active server management session
|
||||
try {
|
||||
const hasServerSess = await hasServerSession(env.DB, telegramUserId);
|
||||
|
||||
if (hasServerSess) {
|
||||
logger.info('서버 관리 세션 감지, Server 에이전트로 라우팅', {
|
||||
userId: telegramUserId
|
||||
});
|
||||
const serverResponse = await processServerConsultation(env.DB, telegramUserId, userMessage, env);
|
||||
|
||||
// PASSTHROUGH: 무관한 메시지는 일반 처리로 전환
|
||||
if (serverResponse !== '__PASSTHROUGH__') {
|
||||
return serverResponse;
|
||||
}
|
||||
// Continue to normal flow below
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error('Server session check failed, continuing with normal flow', error as Error, {
|
||||
telegramUserId
|
||||
});
|
||||
// Continue with normal flow if session check fails
|
||||
}
|
||||
}
|
||||
|
||||
if (!env.OPENAI_API_KEY) {
|
||||
|
||||
Reference in New Issue
Block a user