Skip to content

开放平台的文档有些内容不正确(也可能是旧了),另外我写了一款支持MoonshotAI的neovim插件 #41

@Kurama622

Description

@Kurama622

希望更新一下官网文档

api返回内容的格式描述似乎有误:

官方文档的描述是

data: {"id":"cmpl-1305b94c570f447fbde3180560736287","object":"chat.completion.chunk","created":1698999575,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}]}
 
data: {"id":"cmpl-1305b94c570f447fbde3180560736287","object":"chat.completion.chunk","created":1698999575,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"content":"你好"},"finish_reason":null}]}
 
...
 
data: {"id":"cmpl-1305b94c570f447fbde3180560736287","object":"chat.completion.chunk","created":1698999575,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"content":"。"},"finish_reason":null}]}
 
data: {"id":"cmpl-1305b94c570f447fbde3180560736287","object":"chat.completion.chunk","created":1698999575,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{},"finish_reason":"stop","usage":{"prompt_tokens":19,"completion_tokens":13,"total_tokens":32}}]}
 
data: [DONE]

实际输出的格式:

data: {"id":"chatcmpl-66efb6f2f4dc0b0e6ec210b3","object":"chat.completion.chunk","created":1726985970,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"role":"assistant","content":""},"finish_reason":null}],"system_fingerprint":"fpv0_293876d1"}
data: {"id":"chatcmpl-66efb6f2f4dc0b0e6ec210b3","object":"chat.completion.chunk","created":1726985970,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"content":"Hello"},"finish_reason":null}],"system_fingerprint":"fpv0_293876d1"}
data: {"id":"chatcmpl-66efb6f2f4dc0b0e6ec210b3","object":"chat.completion.chunk","created":1726985970,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"content":"!"},"finish_reason":null}],"system_fingerprint":"fpv0_293876d1"}
...
data: {"id":"chatcmpl-66efb6f2f4dc0b0e6ec210b3","object":"chat.completion.chunk","created":1726985970,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{"content":"?"},"finish_reason":null}],"system_fingerprint":"fpv0_293876d1"}
data: {"id":"chatcmpl-66efb6f2f4dc0b0e6ec210b3","object":"chat.completion.chunk","created":1726985970,"model":"moonshot-v1-8k","choices":[{"index":0,"delta":{},"finish_reason":"stop","usage":{"prompt_tokens":156,"completion_tokens":30,"total_tokens":186}}],"system_fingerprint":"fpv0_293876d1"}
data: [DONE]

多了一个system_fingerprint字段,在解析输出的时候会有影响

支持MoonshotAI的neovim插件

插件地址:https://github.com/Kurama622/llm.nvim
文档说明:https://github.com/Kurama622/llm.nvim/wiki/Modify-LLM#example
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions