continue icon indicating copy to clipboard operation
continue copied to clipboard

code-server下的openai的edit模型无法正常加载messages字段

Open HemiFate opened this issue 5 months ago • 1 comments

Before submitting your bug report

Relevant environment info

- OS:linux 
- Continue version:1.1.76
- IDE version: code-server
- Model:deepseekr1
- config:
 name: DeepSeek
version: 0.0.1
schema: v1

models:
  - name: DeepSeek
    provider: openai
    model: DeepSeek
    apiKey: ""
    apiBase: "..../v1/chat"
    roles:
      - chat
      - edit
      - apply
      - autocomplete
    defaultCompletionOptions:
      temperature: 0.9
      stream: false
      maxTokens: 65535
    # 配置不同角色的提示模板
    promptTemplates:
      # chat角色:使用预设模板(需为插件支持的名称,如llama3/openai格式)
      chat: "deepseek"  
      
      # edit角色:自定义代码编辑模板(变量{{code}}为选中的代码,{{instruction}}为用户指令)
      edit: "请修改以下代码:\n{{code}}\n指令:{{instruction}}"
      
      # apply角色:自定义应用变更的模板(用于自动执行代码修改)
      apply: |
        请根据以下指令修改文件{{filePath}}:
        指令:{{instruction}}
        当前文件内容:
        {{fileContent}}
        请返回需要替换的代码块(格式:旧代码→新代码)。
      
      # autocomplete角色:自定义代码补全模板({{prefix}}为当前输入的代码前缀)
      autocomplete: |
        `
        globalThis.importantFunc = importantFunc
        <|fim_prefix|>{{{prefix}}}<|fim_suffix|>{{{suffix}}}<|fim_middle|>
        `
    requestOptions:
      headers:
        Authorization: "Bearer -FQ"
        Content-Type: "application/json"
        Accept: "application/json"

Description

1、在使用chat模式时,可以正常回答问题,在使用edit时,需要将自定义的URL的链接改写成:https://xxxx/v1/chat。chat模式下为:https://xxxx/v1 2、在配置edit的模板后,使用CTROL+I后,输入:取消代码注释。在日志的请求体重,没有发现messages结构,导致模型无法回答问题。 2025-08-13 15:26:16.293 [error] [窗口] [Extension Host] Error handling webview message: { "msg": { "messageId": "38ec5082-8844-463a-a258-54b103c9b34f", "messageType": "edit/sendPrompt", "data": { "prompt": "取消代码注释", "range": { "range": { "start": { "line": 0, "character": 0 }, "end": { "line": 3, "character": 16 } }, "filepath": "file:///root/work/filestorage/guodong/test.py", "contents": "import os # 导入操作系统模块\ndef add(a, b):\n # 计算两数之和\n return a + b" } } } } 上述字段缺少messages字段,导致openai的格式无法正常使用

To reproduce

No response

Log output


HemiFate avatar Aug 13 '25 07:08 HemiFate

This issue hasn't been updated in 90 days and will be closed after an additional 10 days without activity. If it's still important, please leave a comment and share any new information that would help us address the issue.

github-actions[bot] avatar Nov 12 '25 02:11 github-actions[bot]

This issue was closed because it wasn't updated for 10 days after being marked stale. If it's still important, please reopen + comment and we'll gladly take another look!

github-actions[bot] avatar Nov 23 '25 02:11 github-actions[bot]