Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Piping certain cmd outputs to shell sage causes LiteLLM `This model does not support assistant message prefill. The conversation must end with a user message.`

未关闭 适合新手
#79 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
68/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
python, shell
领域
cli

调研方向

从 ipyai/core.py 开始,检查 _shell_re 和 IPyAIExtension 的 completion 路径,然后将报告中的命令输出通过管道传给 ShellSage,以重现该故障。将请求构造和缓存行为与最小复现进行比较;当相同的管道输出能够在不出现 LiteLLM assistant-prefill 错误的情况下完成时,即视为完成。

由索引模型根据 Issue 内容生成。

描述

diff --git a/ipyai/core.py b/ipyai/core.py
index c2e7e9e..7db83c1 100644
--- a/ipyai/core.py
+++ b/ipyai/core.py
@@ -102,7 +102,7 @@ prompt_from_lines astream_to_stdout transform_dots unload_ipython_extension""".s
 _prompt_template = """{context}<user-request>{prompt}</user-request>"""
 _tool_re = re.compile(r"&`(\w+)`")
 _var_re = re.compile(r"\$`(\w+)`")
-_shell_re = re.compile(r"!`([^`]+)`")
+_shell_re = re.compile(r"(?<![\w`])!`([^`]+)`")
 _tool_block_re = re.compile(
     r"<details class='tool-usage-details'>\s*<summary>([^\n]*?)</summary>\s*```json\s*(.*?)\s*```\s*</details>", flags=re.DOTALL)
 _status_attrs = "model completion_model think search code_theme log_exact".split()
@@ -788,7 +788,7 @@ class IPyAIExtension:
         parts.append("</current-input>")
         parts.append("\nReturn ONLY the completion text to insert immediately after the prefix."
             " Do not repeat the prefix or include any explanation.")
-        chat = AsyncChat(model=self.completion_model, sp=_COMPLETION_SP)
+        chat = AsyncChat(model=self.completion_model, sp=_COMPLETION_SP, cache=True)
         res = await chat("\n".join(parts))
         return (contents(res).content or "").strip()

Minimal repro. Piping this into shell sage leads to:

litellm.exceptions.BadRequestError: litellm.BadRequestError: AnthropicException - b'{"type":"error","error":{"type":"invalid_request_error","message":"This model does not support assistant message prefill. The conversation must end with a user message."},"request_id":"req_011CZSMPZ3QszFE6X6fwGrSC"}'

Might be a lisette issue.

主要语言
Jupyter Notebook
星标
409
派生
44
PR 合并指标
30 天内没有已合并 PR

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

AnswerDotAI/shell_sage 的其他 Issue

查看 AnswerDotAI/shell_sage 的全部 Issue

相似的 Issue

更多 CLI Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。