1
This commit is contained in:
@@ -417,3 +417,36 @@ fn build_event_stream_response(body: String) -> Response {
|
||||
fn runtime_chat_error_response(request_context: &RequestContext, error: AppError) -> Response {
|
||||
error.into_response_with_context(Some(request_context))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn npc_chat_affinity_delta_keeps_node_keyword_rules() {
|
||||
assert_eq!(
|
||||
compute_npc_chat_affinity_delta("谢谢你愿意帮忙", "放心,我明白。", 0.0),
|
||||
3
|
||||
);
|
||||
assert_eq!(
|
||||
compute_npc_chat_affinity_delta("快说,别装。", "与你无关。", 2.0),
|
||||
-3
|
||||
);
|
||||
assert_eq!(
|
||||
compute_npc_chat_affinity_delta("这里怎么了", "我还在想。", 0.0),
|
||||
1
|
||||
);
|
||||
assert_eq!(
|
||||
compute_npc_chat_affinity_delta("这里怎么了", "我还在想。", 2.0),
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn npc_chat_suggestion_parser_strips_list_markers() {
|
||||
assert_eq!(
|
||||
parse_line_list_content("1. 继续问线索\n- 表明立场\n* 拉近关系\n4. 多余", 3),
|
||||
vec!["继续问线索", "表明立场", "拉近关系"]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user