범인찾기 C2: 사이트 서버 Claude 호출 · 근거 확인 · 예산 장부
- POST /api/culprit/matches/:id/analyze: 등록된 앱 유저 이상(다시 분석은 관리자), 월 $100 · 하루 20회 · 중복 잠금 - Claude Opus 5.5 (생각 high, 구조화 출력, 출력 32k 상한, 거절 시 서버 측 fallback), 지시문 + 게임별 지식 묶음(자동 갱신 칸은 공식 데이터로 하루 한 번) - 결과 확인: 10명 · 0.5 단위 점수 · 태그 · 팀마다 범인 1명(팀 최저점) · 없는 근거 번호 제거, 범인 근거가 안 맞으면 한 번 다시 - 비용 장부(culprit-ledger.json)는 토큰 · 비용만, 진행 단계는 실시간 알림(culprit.progress) - 지시문 v1.1: 범인 = 가장 못함 + 가장 발목 + 결과의 원인 종합 판단, 자료 약어 설명 추가 - 배포: Dockerfile 에 prompt/ 복사, ANTHROPIC_API_KEY 넣는 스크립트 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,8 @@ import path from 'node:path';
|
||||
import type { Config } from './config.js';
|
||||
import { registerAppAuth } from './app-auth.js';
|
||||
import { BotBroker, type BotSource } from './bot-broker.js';
|
||||
import { registerCulprit, type ModelCall } from './culprit.js';
|
||||
import type { KnowledgeAuto } from './culprit-prompt.js';
|
||||
import { avatarUrl, DiscordApi } from './discord.js';
|
||||
import { RateLimiter } from './rate-limit.js';
|
||||
import { RelayHub } from './relay.js';
|
||||
@@ -16,7 +18,7 @@ const SID = 'gvr_sid';
|
||||
const RECHECK_MS = 10 * 60000;
|
||||
|
||||
/** botSource: 겜녹이 봇 디스코드 연결 (main.ts 가 discord.js 로 만든다. 없으면 /app/bot/ws 는 503) */
|
||||
export async function buildServer(cfg: Config, opts: { botSource?: BotSource; botRecheckMs?: number } = {}) {
|
||||
export async function buildServer(cfg: Config, opts: { botSource?: BotSource; botRecheckMs?: number; culpritCall?: ModelCall; culpritKnowledge?: KnowledgeAuto } = {}) {
|
||||
const app = Fastify({
|
||||
logger: {
|
||||
level: process.env.LOG_LEVEL || 'info',
|
||||
@@ -174,6 +176,9 @@ export async function buildServer(cfg: Config, opts: { botSource?: BotSource; bo
|
||||
return r;
|
||||
});
|
||||
|
||||
// ------------------------------------------------------------------ 범인찾기 (Claude API 는 이 서버만 부른다)
|
||||
const culprit = registerCulprit(app, { cfg, store, hub, requireSession, log: app.log, call: opts.culpritCall, knowledge: opts.culpritKnowledge });
|
||||
|
||||
// ------------------------------------------------------------------ 기록 API 중계
|
||||
const relay = async (req: FastifyRequest, reply: FastifyReply) => {
|
||||
const s = await requireSession(req, reply);
|
||||
@@ -281,7 +286,7 @@ export async function buildServer(cfg: Config, opts: { botSource?: BotSource; bo
|
||||
store.flush();
|
||||
});
|
||||
|
||||
return { app, store, hub, broker };
|
||||
return { app, store, hub, broker, culprit };
|
||||
}
|
||||
|
||||
/** 로그에 남길 주소: /auth/* 는 쿼리를 지우고 앱 로그인 요청 아이디를 가린다, 다른 주소도 쿼리 값은 지운다 */
|
||||
|
||||
Reference in New Issue
Block a user