Merge remote-tracking branch 'origin/server_node'
Some checks failed
CI / verify (push) Has been cancelled

This commit is contained in:
2026-04-08 19:16:55 +08:00
69 changed files with 8262 additions and 81 deletions

View File

@@ -10,6 +10,7 @@ import type {
QuestLogEntry,
} from '../types';
import type {QuestGenerationContext} from './aiTypes';
import { requestJson } from './apiClient';
import {requestChatMessageContent} from './llmClient';
import {parseJsonResponseText} from './llmParsers';
import {buildQuestIntentPrompt, QUEST_INTENT_SYSTEM_PROMPT} from './questPrompt';
@@ -217,6 +218,22 @@ export async function generateQuestForNpcEncounter(params: {
const fallbackIntent = buildFallbackQuestIntent(request);
if (typeof window !== 'undefined') {
try {
return await requestJson<QuestLogEntry | null>(
'/api/runtime/quests/generate',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(params),
},
'任务生成失败',
);
} catch (error) {
console.warn('[QuestDirector] backend quest generation failed, falling back', error);
}
}
try {
const content = await requestChatMessageContent(
QUEST_INTENT_SYSTEM_PROMPT,