fix: 修复 basedpyright 类型错误和语言设置同步问题
runner.py: 将 user_text 解构从 tuple 第二元素改为第一元素(str), 消除 str | list[dict[str,Any]] 与 Msg.content 的类型不兼容问题。 简化了始终为 true 的 user_blocks 条件分支。 repository.py: 将 result.rowcount 的 type: ignore 替换为基于 pyright: ignore[reportAttributeAccessIssue],消除 basedpyright 错误。 app.dart: 保存 profile 时同步 _locale 和 session store 中的语言标记。
This commit is contained in:
@@ -324,8 +324,7 @@ class AgentScopeRunner:
|
||||
if derived_divination is not None:
|
||||
user_text = build_divination_user_prompt(derived=derived_divination)
|
||||
else:
|
||||
_, latest_user_text = extract_latest_user_payload(run_input)
|
||||
user_text = latest_user_text
|
||||
user_text, _ = extract_latest_user_payload(run_input)
|
||||
|
||||
if derived_divination is not None and context_messages:
|
||||
last = context_messages[-1]
|
||||
@@ -342,17 +341,7 @@ class AgentScopeRunner:
|
||||
if last.role == "user":
|
||||
return context_messages
|
||||
|
||||
user_blocks = [{"type": "text", "text": user_text}]
|
||||
if (
|
||||
user_blocks
|
||||
and isinstance(user_blocks[0], dict)
|
||||
and user_blocks[0].get("type") == "text"
|
||||
):
|
||||
content: Any = user_text
|
||||
else:
|
||||
content = user_blocks
|
||||
|
||||
user_msg = Msg(name="user", role="user", content=content)
|
||||
user_msg = Msg(name="user", role="user", content=user_text)
|
||||
return [*context_messages, user_msg]
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user