chore: create Multica handoff checkpoint
This commit is contained in:
@@ -129,9 +129,10 @@ class MentorServiceMixin:
|
||||
|
||||
def generate():
|
||||
answer_parts: list[str] = []
|
||||
follow_ups: list[str] = []
|
||||
events = self.llm_gateway.stream(
|
||||
"mentor",
|
||||
f"mentor-skill-v1:{skill.skill_id}",
|
||||
f"mentor-skill-v2:{skill.skill_id}",
|
||||
lambda profile: stream_with_mentor(
|
||||
skill,
|
||||
context,
|
||||
@@ -140,6 +141,7 @@ class MentorServiceMixin:
|
||||
profile.api_key,
|
||||
profile.base_url,
|
||||
profile.model,
|
||||
follow_ups=follow_ups,
|
||||
),
|
||||
(MentorAgentError,),
|
||||
)
|
||||
@@ -160,6 +162,7 @@ class MentorServiceMixin:
|
||||
yield {
|
||||
"type": "meta",
|
||||
"data_trade_date": context["data_trade_date"],
|
||||
"follow_ups": follow_ups or self._mentor_follow_up_fallback(question),
|
||||
"notice": "智能解读已自动切换可用服务。"
|
||||
if event.role == "fallback"
|
||||
else "",
|
||||
@@ -167,6 +170,27 @@ class MentorServiceMixin:
|
||||
|
||||
return generate()
|
||||
|
||||
@staticmethod
|
||||
def _mentor_follow_up_fallback(question: str) -> list[str]:
|
||||
normalized = question.strip()
|
||||
if any(keyword in normalized for keyword in ("风险", "亏损", "回撤", "止损")):
|
||||
return [
|
||||
"这些风险最早会从哪些信号中暴露?",
|
||||
"哪些变化会让当前风险判断失效?",
|
||||
"如果风险继续扩大,仓位预案应如何调整?",
|
||||
]
|
||||
if any(keyword in normalized for keyword in ("股票", "个股", "代码", "怎么看")):
|
||||
return [
|
||||
"这个判断最关键的确认信号是什么?",
|
||||
"哪些变化会让当前结论失效?",
|
||||
"明日盘中应该优先观察哪些数据?",
|
||||
]
|
||||
return [
|
||||
"这个判断最关键的确认依据是什么?",
|
||||
"哪些变化会让当前结论失效?",
|
||||
"下一步应该优先观察什么?",
|
||||
]
|
||||
|
||||
def mentor_messages(self, mentor_id: str, trade_date: str) -> list[dict[str, Any]]:
|
||||
mentor_id = validate_text(mentor_id, "问师角色", 100, required=True)
|
||||
trade_date = normalize_date(trade_date)
|
||||
|
||||
Reference in New Issue
Block a user