清理后端编译警告
删除后端未使用的历史 helper、mapper、handler 和 re-export 将仅测试使用的导入、常量和辅助函数收口到 cfg(test) 补齐 Jump Hop 测试构造体字段并对齐 Match3D 当前素材表测试契约 验证后端 workspace cargo check 与 Match3D、Puzzle 相关测试
This commit is contained in:
@@ -1,16 +1,5 @@
|
||||
use serde_json::{Value, json};
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct RuntimeStoryTextPromptParams<'a> {
|
||||
pub world_type: &'a str,
|
||||
pub character: Value,
|
||||
pub monsters: Value,
|
||||
pub history: Value,
|
||||
pub choice: Value,
|
||||
pub context: Value,
|
||||
pub available_options: Value,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct RuntimeNpcDialoguePromptParams<'a> {
|
||||
pub world_type: &'a str,
|
||||
@@ -25,42 +14,6 @@ pub(crate) struct RuntimeNpcDialoguePromptParams<'a> {
|
||||
pub available_options: Vec<Value>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub(crate) struct RuntimeReasonedStoryPromptParams<'a> {
|
||||
pub world_type: &'a str,
|
||||
pub character: &'a Value,
|
||||
pub monsters: Vec<Value>,
|
||||
pub history: Vec<Value>,
|
||||
pub context: Value,
|
||||
pub choice: &'a str,
|
||||
pub result_summary: &'a str,
|
||||
pub requested_option: Value,
|
||||
pub available_options: Vec<Value>,
|
||||
}
|
||||
|
||||
pub(crate) fn runtime_story_director_system_prompt(initial: bool) -> &'static str {
|
||||
if initial {
|
||||
"你是游戏运行时剧情导演。请用中文输出一段可直接展示给玩家的开局剧情,不要输出 JSON。"
|
||||
} else {
|
||||
"你是游戏运行时剧情导演。请用中文根据玩家选择续写一段剧情,不要输出 JSON。"
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn build_runtime_story_director_user_prompt(
|
||||
params: RuntimeStoryTextPromptParams<'_>,
|
||||
) -> String {
|
||||
json!({
|
||||
"worldType": params.world_type,
|
||||
"character": params.character,
|
||||
"monsters": params.monsters,
|
||||
"history": params.history,
|
||||
"choice": params.choice,
|
||||
"context": params.context,
|
||||
"availableOptions": params.available_options,
|
||||
})
|
||||
.to_string()
|
||||
}
|
||||
|
||||
pub(crate) fn runtime_npc_dialogue_system_prompt() -> &'static str {
|
||||
"你是游戏运行时 NPC 对话导演。只输出中文正文,不要输出 JSON、Markdown 或规则说明;不要新增系统尚未结算的奖励、任务结果或战斗结果。"
|
||||
}
|
||||
@@ -200,31 +153,6 @@ pub(crate) fn build_npc_recruit_dialogue_user_prompt(
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn runtime_reasoned_story_system_prompt() -> &'static str {
|
||||
"你是游戏运行时剧情导演。只输出中文剧情正文,不要输出 JSON、Markdown 或规则说明;必须尊重已结算的战斗 outcome、伤害和状态,不要发明额外奖励。"
|
||||
}
|
||||
|
||||
pub(crate) fn build_runtime_reasoned_story_user_prompt(
|
||||
params: RuntimeReasonedStoryPromptParams<'_>,
|
||||
) -> String {
|
||||
let state_prompt = json!({
|
||||
"worldType": params.world_type,
|
||||
"character": params.character,
|
||||
"monsters": params.monsters,
|
||||
"history": params.history,
|
||||
"context": params.context,
|
||||
"choice": params.choice,
|
||||
"resultSummary": params.result_summary,
|
||||
"requestedOption": params.requested_option,
|
||||
"availableOptions": params.available_options,
|
||||
})
|
||||
.to_string();
|
||||
|
||||
format!(
|
||||
"请基于以下运行时状态,为这一轮战斗结算生成一段 120 字以内的结果叙事,并自然引出下一组选项。\n{state_prompt}"
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) const NPC_CHAT_TURN_REPLY_SYSTEM_PROMPT: &str = r#"你是角色扮演 RPG 里的当前 NPC。
|
||||
你只输出这名 NPC 此刻会对玩家说的一轮回复。
|
||||
只输出纯中文口语回复正文,不要输出角色名、引号、旁白、动作描写、Markdown、JSON 或解释。
|
||||
|
||||
Reference in New Issue
Block a user