初始化提交
This commit is contained in:
commit
887c1f449e
963 files changed
+166869
No files matched your search
@@ -0,0 +1,25 @@
|
||||
"""太一会话目标提取(纯函数,无 IO)。
|
||||
|
||||
从用户消息提取会话目标(L2)。v1 采用规则提取——用户消息本身即目标的最直接
|
||||
表达,清理与截断后写入 ``run.goal`` 并注入运行契约。LLM 提取为后续增强。
|
||||
"""
|
||||
|
||||
_MAX_GOAL_CHARS = 120
|
||||
|
||||
|
||||
def extract_session_goal(content: str) -> str:
|
||||
"""从用户消息内容提取会话目标摘要。
|
||||
|
||||
规则:去除首尾空白,超长截断到 ``_MAX_GOAL_CHARS``;空内容返回空串。
|
||||
"""
|
||||
goal = (content or "").strip()
|
||||
if not goal:
|
||||
return ""
|
||||
return goal[:_MAX_GOAL_CHARS]
|
||||
|
||||
|
||||
def format_goal_directive(goal: str) -> str:
|
||||
"""把会话目标格式化为运行契约的 system instruction 片段;空目标返回空串。"""
|
||||
if not goal:
|
||||
return ""
|
||||
return f"当前会话目标:{goal}"
|
||||
Reference in new issue
Block a user