[已解决]提问:关于内网进行代码补全的一些问题

最近发现idea的插件codeGPT可以调用本地的大模型,于是在内网服务器上利用Ollama部署了大模型,同codeGPT进行调用时发现无法进行代码补全,但是可以进行对话,请问有佬做过类似的操作么?

1 个赞

tabby 好像是叫这个,不过感觉没github的好用

1 个赞

tabby不是ssh工具么

猜测一下会不会是补全用的接口和对话用的接口不是同一个?内容补全用的一般是/v1/completions而对话用的是/v1/chat/completions。

1 个赞

搞成 openai 的格式, 用 @neo 的 那个 直接替换 , 然后走 github copilot

1 个赞
1 个赞

听上去像是配置问题. 论坛有些 Continue 插件的实现类似功能. 可以搜索看下.

1 个赞

这个本地跑出现这个错误佬有遇到嘛

2024/05/28 16:44:29 request completions failed: {"error":{"message":"[] is too short - 'messages'","type":"invalid_request_error","param":null,"code":null}}
[GIN] 2024/05/28 - 16:44:29 | 400 |  103.943458ms |       127.0.0.1 | POST     "/v1/engines/copilot-codex/completions"
[GIN] 2024/05/28 - 16:44:32 | 408 |  101.293458ms |       127.0.0.1 | POST     "/v1/engines/copilot-codex/completions"
2024/05/28 16:44:32 request completions failed: {"error":{"message":"[] is too short - 'messages'","type":"invalid_request_error","param":null,"code":null}}
[GIN] 2024/05/28 - 16:44:32 | 400 |     102.214ms |       127.0.0.1 | POST     "/v1/engines/copilot-codex/completions"
2024/05/28 16:44:33 request completions failed: {"error":{"message":"[] is too short - 'messages'","type":"invalid_request_error","param":null,"code":null}}
1 个赞

我没有 反馈给 @neo

1 个赞

在哪反馈哈哈

  1. 如果调不通,请确认http://localhost:11434/v1/chat可用。
    我这个显示的是404 本地ollama
$ curl http://localhost:11434/v1/chat/completions \
    -H "Content-Type: application/json" \
    -d '{
        "model": "stable-code:3b-code-fp16",
        "messages": [
            {
                "role": "user",
                "content": "Hello!"
            }
        ]
    }'
{"id":"chatcmpl-780","object":"chat.completion","created":1716887758,"model":"stable-code:3b-code-fp16","system_fingerprint":"fp_ollama","choices":[{"index":0,"message":{"role":"assistant","content":"\u003c/div\u003e\n      \u003chr /\u003e\n      \u003cimg src={logo} alt=\"React Logo\" /\u003e\n\n    \u003c/\u003e\n  );\n}\n\u003crepo_continuation\u003e\nimport React from 'react';\n// import {Link } from \"gatsby\"; \nfunction Link(props) { \n  const href = props.href || '#........

测试接口没啥问题

1 个赞

接入试试

1 个赞

会不会是因为 模型不认识啊, 你给 API 里边的模型改成 GPT4 和 GPT3.5 呢? 反正就是个名字 你本地的 你知道不就行了

1 个赞

蹲一下

1 个赞

这里没有

1 个赞

想看后续

1 个赞

等后续

1 个赞

统一回复:非常感谢大家的评论,最新版本的CodeGPT插件是可以和Ollama本地大模型进行配合进行代码补全的,但是对IDEA的版本有要求,建议使用2023.3.X及以上版本。

2 个赞