CommandCodeAI / CommandCodeAI/command-code

<think> tags and "thought" leaks into transcript feed with qwen-3.7-plus

未关闭
#598 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
没有语言数据
星标
4k
派生
350
PR 合并指标
30 天内没有已合并 PR

描述

Summary

I am building a spell checking mod with qwen-3.7-plus and several times (when context gets a big longer), the <think> end tag isn't parsed and thus "thought" leaks into the feed window of TUI:

✻ Thought for 4 seconds [ctrl+o to expand]

⠶ </think>



  The user wants me to continue. I need to fix the __dirname / import.meta issue. Since this is a mod that runs in Command Code's jiti environment, __dirname
  should be available. But the TypeScript checker is complaining because it doesn't know about the runtime environment.

  Let me simplify the _dirname resolution to just use __dirname since jiti provides it. Or I can use a different approach - use cmd.cwd which is the workspace
  root, and then resolve relative to that.

  Actually, looking at the mod-builder docs, mods are loaded by jiti which compiles TypeScript at load time. The __dirname should be available in that context.
  But the TypeScript checker doesn't know about it.

  Let me just use a simpler approach - declare __dirname as a global or use a try/catch approach. Or better yet, since the mod file and the dictionary file are in
   the same directory, I can use import.meta.url but that also has issues with TypeScript.

  The simplest fix is to just declare __dirname at the top of the file or use a different approach. Let me check what the mod-builder examples do.

  Actually, looking at the mod-builder skill instructions, it says mods are loaded by jiti which compiles TypeScript at load time. In a CommonJS context (which
  jiti uses), __dirname is available. The issue is just that TypeScript doesn't know about it.

  Let me just add a declaration at the top of the file or use a workaround. The simplest is to use process.cwd() or pass the path as a parameter.

  Actually, the best approach is to just use __dirname but declare it properly. Let me fix this.
  Now fix the __dirname issue — jiti provides __dirname at runtime, but TypeScript doesn't know about it:


───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Edit File .commandcode/mods/spell-checker.ts

 534 │ - const _dirname = typeof __dirname !== 'undefined'
 535 │ -  ? __dirname
 536 │ -  : dirname(fileURLToPath(import.meta.url));
 534 │ + // jiti (the mod loader) provides __dirname at runtime
 535 │ + declare const __dirname: string;
 536 │
 538 │ - const BUILTIN_DICTIONARY_PATH = join(_dirname, 'frequency_dictionary_en_82_765.txt');
 537 │ + const BUILTIN_DICTIONARY_PATH = join(__dirname, 'frequency_dictionary_en_82_765.txt');
Expected Behavior
  • model though is hidden behind expand ctrl+0
Actual Behavior

The </think> end tag is seen in the feed conversation transcript.

Steps to reproduce the issue
  1. Use qwen-3.7-plus
Command Code Version

1.4.6

Operating System

macOS

Terminal/IDE

ghostty

Shell

zsh

Additional context

No response

贡献指南

这个仓库没有索引到贡献指南

从这里开始

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

调研方向

使用 qwen-3.7-plus 复现该问题,并检查 transcript feed 对 块及其结束标签的处理。验证模型的思考内容是否隐藏在展开控件后面,以及 feed 中是否不会出现字面形式的 标签。

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

评估

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

把新 issue 发到你的邮箱

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