CodeGPT icon indicating copy to clipboard operation
CodeGPT copied to clipboard

json: cannot unmarshal object into Go struct field

Open h-b opened this issue 6 months ago • 3 comments

Environment

codegpt version: 0.14.2 (commit: fd5758c) Model: Gemma 2 (via local KoboldCpp 1.72 instance)

I’ve configured codegpt to use a local KoboldCpp instance:

codegpt config set openai.base_url http://localhost:5001/v1
codegpt config set openai.timeout 1m

Issue Description

The configured koboldcpp endpoint is designed to be compatible with the OpenAI API format, see https://github.com/LostRuins/koboldcpp#Notes. Given this API compatibility, codegpt review operates without throwing errors (although the output quality depends on the specific model used). However, codegpt commit encounters a persistent issue, resulting in the following error:

❯ codegpt commit
Summarize the commit message use gpt-3.5-turbo model
We are trying to summarize a git diff
PromptTokens: 100, CompletionTokens: 100, TotalTokens: 200
We are trying to summarize a title for pull request
PromptTokens: 100, CompletionTokens: 100, TotalTokens: 200
We are trying to get conventional commit prefix (Tools)
Error: json: cannot unmarshal object into Go struct field ChatCompletionChoice.choices.message of type string

Expected Behavior

The command should process the commit message successfully, even if the model outputs unusual characters.

h-b avatar Aug 21 '24 08:08 h-b