feat:架构重构

This commit is contained in:
2026-10-01 23:08:06 -07:00
parent b82dc93404
commit 68588d1f92
74 changed files with 1131 additions and 3492 deletions
+2 -20
View File
@@ -3,28 +3,9 @@
from app.schemas.decision import ChoiceDecision
def build_offer_question() -> ChoiceDecision:
# 上一轮助手提出了具体修改时追加的判断,只看用户对这条提议的回应,比从历史文本推断意图更可靠
return ChoiceDecision(
instructions=(
"In the previous turn the assistant offered to perform the edit in `pending_offer` and asked whether the user wants it. "
"Classify how the latest user message (`prompt`) responds to that offer. "
"Judge by its function in the conversation, not by a fixed word list; short replies are normal."
),
criteria={
# 同意执行提议,包括简短的肯定回答
"accept": "Agrees to perform exactly the offered edit, e.g. Okay, need, want, can, alright, mm-hmm, yes",
# 拒绝提议
"decline": "Declines the offer or says it is not needed, e.g. No, never mind, no",
# 提出新的或修改过的请求、提问,或与提议无关
"other": "Asks something else, requests a different or changed edit, or does not respond to the offer",
},
)
def build_intent_question() -> ChoiceDecision:
return ChoiceDecision(
# 区分意图模糊与修改细节缺失,后者交给需求理解
# 区分意图模糊与修改细节缺失,后者交给 screen agent
instructions=(
"Classify the user's primary intent. "
"Classify the latest user answer in `clarification_history`, or `prompt` when there is no history. "
@@ -34,6 +15,7 @@ def build_intent_question() -> ChoiceDecision:
"Choose qa for clear requests for a textual answer or general conversation, including information, explanation, diagnosis, advice, and assistant identity or capabilities. "
"Requests need not be phrased as questions; being unrelated to screens does not make an intent unclear. "
"A short conversational message that acknowledges, agrees, thanks, greets or closes the exchange (e.g. ok, Okay, um, got it, thanks, hello, goodbye) requests nothing further and is qa; decide by its function in the conversation, not by a fixed word list, and never treat it as unclear merely for being short. "
"When the assistant's last turn in `history` offered to make a specific edit, a reply agreeing to it (e.g. ok, yes, go ahead) requests that edit and is modify_screen. "
"A vague complaint or evaluation without a requested next step is unclear, not automatically qa. "
"An explicit edit request remains modify_screen even when edit details are missing. "
"Do not infer intent solely from selected nodes or an empty screen."