Skip to content

Commit

Permalink
支持kimi+智能体调用
Browse files Browse the repository at this point in the history
  • Loading branch information
Vinlic committed Apr 30, 2024
1 parent 6105410 commit 889c874
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
![](https://img.shields.io/github/forks/llm-red-team/kimi-free-api.svg)
![](https://img.shields.io/docker/pulls/vinlic/kimi-free-api.svg)

支持高速流式输出、支持多轮对话、支持联网搜索、支持长文档解读、支持图像解析,零配置部署,多路token支持,自动清理会话痕迹。
支持高速流式输出、支持多轮对话、支持联网搜索、支持智能体对话、支持长文档解读、支持图像解析,零配置部署,多路token支持,自动清理会话痕迹。

与ChatGPT接口完全兼容。

Expand Down Expand Up @@ -85,6 +85,12 @@ https://udify.app/chat/Po0F6BMJ15q5vu2P

![联网搜索](./doc/example-2.png)

### 智能体对话Demo

此处使用 [翻译通](https://kimi.moonshot.cn/chat/coo6l3pkqq4ri39f36bg) 智能体。

![智能体对话](./doc/example-7.png)

### 长文档解读Demo

![长文档解读](./doc/example-5.png)
Expand Down Expand Up @@ -269,7 +275,8 @@ Authorization: Bearer [refresh_token]
请求数据:
```json
{
// 模型名称随意填写,如果不希望输出检索过程模型名称请包含silent_search
// model随意填写,如果不希望输出检索过程模型名称请包含silent_search
// 如果使用kimi+智能体,model请填写智能体ID,就是浏览器地址栏上尾部的一串英文+数字20个字符的ID
"model": "kimi",
// 目前多轮对话基于消息合并实现,某些场景可能导致能力下降且受单轮最大Token数限制
// 如果您想获得原生的多轮对话体验,可以传入首轮消息获得的id,来接续上下文,注意如果使用这个,首轮必须传none,否则第二轮会空响应!
Expand Down
Binary file added doc/example-7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/api/controllers/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ async function createCompletion(model = MODEL_NAME, messages: any[], refreshToke
} = await acquireToken(refreshToken);
const sendMessages = messagesPrepare(messages, !!refConvId);
const result = await axios.post(`https://kimi.moonshot.cn/api/chat/${convId}/completion/stream`, {
kimiplus_id: /^[0-9a-z]{20}$/.test(model) ? model : undefined,
messages: sendMessages,
refs,
use_search: useSearch
Expand Down Expand Up @@ -338,6 +339,7 @@ async function createCompletionStream(model = MODEL_NAME, messages: any[], refre
} = await acquireToken(refreshToken);
const sendMessages = messagesPrepare(messages, !!refConvId);
const result = await axios.post(`https://kimi.moonshot.cn/api/chat/${convId}/completion/stream`, {
kimiplus_id: /^[0-9a-z]{20}$/.test(model) ? model : undefined,
messages: sendMessages,
refs,
use_search: useSearch
Expand Down

0 comments on commit 889c874

Please sign in to comment.