Giter Site home page Giter Site logo

Comments (12)

Vinlic avatar Vinlic commented on June 14, 2024 1

如果你已经部署在本地并且使用8000端口,可以用以下代码请求。
@DemonsAH

curl --location --request POST 'http://localhost:8000/v1/chat/completions' \
--header 'Authorization: Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpX...' \
--header 'Content-Type: application/json' \
--data '{
    "model": "kimi",
    "messages": [
        {
            "role": "user",
            "content": "你是谁?"
        }
    ]
}'

响应内容:

{
  "id": "co9bsopldu5r8bme6fp0",
  "model": "kimi",
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "我是Kimi,由月之暗面科技有限公司开发的人工智能助手。我在这里为您提供帮助,回答问题,解决问题,并提供信息。无论是日常知识、数据分析还是其他任何问题,只要告诉我,我都会尽力为您提供准确和有用的回答。"
      },
      "finish_reason": "stop"
    }
  ],
  "usage": { "prompt_tokens": 1, "completion_tokens": 1, "total_tokens": 2 },
  "created": 1712504419
}

from kimi-free-api.

adminlove520 avatar adminlove520 commented on June 14, 2024 1

@adminlove520 vercel我测试部署正常,可能得提供更多信息确认。

我感觉应该问题在 我用的vps上 回头搞个国内的主机测试一下 谢谢解惑啦 @Vinlic

from kimi-free-api.

DemonsAH avatar DemonsAH commented on June 14, 2024

@Vinlic 感谢大佬回答!可惜仍是不能顺利收到正确的响应内容
使用wsl ubuntu原生部署,运行上面的命令得到下面的报错:

$ curl --location --request POST 'http://localhost:8000/v1/chat/completions' --header 'Authorization: Bearer eyJhbG...' --header 'Content-Type: application/json' --data '{
    "model": "kimi",
    "messages": [
        {
            "role": "user",
            "content": "你是谁?"
        }
    ]
}'
{"code":-1,"message":"Internal error","data":null}

此时pm2 log 有反应同样报错
(如果用本机IP代替localhost报错变为Timeout,pm2 log能收到信息和token)

Docker部署
使用windows Docker Desktop部署完成后
使用anaconda直接跑python代码(跟着这个教程
简述操作:python使用opanai的示例代码,修改token和base url
Docker显示如下:
image
(使用本机IP代替localhost无区别)

最后尝试Dify和NextChat(跟着这个教程
操作与上面无异,即使用OpenAI端口,修改token和base
结果: Dify在设置供应商时Connection error
NextChat报错 failed to fetch
问题: 这些报错是否来自相同的原因?有没有本机为国外IP无法使用服务的可能?

from kimi-free-api.

Vinlic avatar Vinlic commented on June 14, 2024

@DemonsAH base url设置错误,/chat/completions不包含在base url中,另外curl调用有问题需要提供服务的日志截图。
不建议把服务部署在国外服务器,有可能连不上kimi。

from kimi-free-api.

denghb001 avatar denghb001 commented on June 14, 2024

作为一个纯小白,遇到了这样的问题
使用windows Docker Desktop部署完成后,
image
运行时出错了
image

from kimi-free-api.

Vinlic avatar Vinlic commented on June 14, 2024

@denghb001 请查看容器日志并截图方便检查

from kimi-free-api.

adminlove520 avatar adminlove520 commented on June 14, 2024

image
image
@Vinlic 请问 docker部署好之后,curl成功,但是nextchat内配置之后一直返回

{
  "error": true,
  "message": "Failed to fetch"
}

{
  "error": true,
  "message": "empty response from server"
}

nextchat配置是这样的
image

from kimi-free-api.

adminlove520 avatar adminlove520 commented on June 14, 2024

请问这个如何解决呀 按理说 curl通的话 nextchat应该可以的呀 baseurl试了好几次。。 @Vinlic

from kimi-free-api.

Vinlic avatar Vinlic commented on June 14, 2024

@adminlove520 检查你在使用nextchat调用时的容器日志

from kimi-free-api.

adminlove520 avatar adminlove520 commented on June 14, 2024

@adminlove520 检查你在使用nextchat调用时的容器日志

甚至请求都没到容器日志 vercel部署的nextchat

from kimi-free-api.

adminlove520 avatar adminlove520 commented on June 14, 2024

但是吧 本地部署的nextchat就可以正常调用 vercel就不行 网络的问题嘛?

from kimi-free-api.

Vinlic avatar Vinlic commented on June 14, 2024

@adminlove520 vercel我测试部署正常,可能得提供更多信息确认。

from kimi-free-api.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.