mirror of
https://github.com/modelstudioai/cli.git
synced 2026-09-14 19:49:23 +08:00
ca69316446
- 在 CLI 命令中添加 knowledgeSearch 和 knowledgeChat 两个新命令 - 新增 knowledge 搜索命令,支持多模态图像检索及对话历史上下文传递 - 新增 knowledge 问答命令,支持多轮消息流式回答及多模态输入 - 在核心客户端库(core)中添加对应的 API 端点和类型定义 - 知识库检索接口 retrieve 标注为弃用,推荐使用 search 命令替代 - 更新 kscli 主程序入口,接入新命令并兼容旧命令 - 补充 e2e 测试覆盖 knowledge search 和 knowledge chat 的各类边界与流程 - 更新文档及命令示例,实现使用说明同步最新功能 - 增加测试配置,改善 E2E 测试环境与超时设置
101 lines
3.1 KiB
Markdown
101 lines
3.1 KiB
Markdown
<div align="center">
|
||
|
||
# Knowledge Studio CLI
|
||
|
||
**阿里云 Model Studio 轻量级 RAG 命令行工具 — 专注知识库检索。**
|
||
|
||
[](https://www.npmjs.com/package/knowledge-studio-cli)
|
||
[](https://nodejs.org)
|
||
[](https://www.typescriptlang.org)
|
||
[](LICENSE)
|
||
|
||
[Knowledge Studio 控制台](https://rag.console.aliyun.com/) · [English](README.md) · [API 文档](https://help.aliyun.com/zh/model-studio/)
|
||
|
||
</div>
|
||
|
||
## 这是什么?
|
||
|
||
`kscli` 是阿里云 Model Studio (DashScope) 平台的**知识库检索**专用命令行工具,专为 RAG(检索增强生成)场景打造。
|
||
|
||
## 安装
|
||
|
||
```bash
|
||
npm install -g knowledge-studio-cli
|
||
```
|
||
|
||
> 需要 Node.js >= 22.12。
|
||
|
||
## 快速开始
|
||
|
||
```bash
|
||
# 检索知识库
|
||
kscli search \
|
||
--query "什么是 Model Studio?" \
|
||
--agent-id <your-agent-id> \
|
||
--workspace-id <your-workspace-id>
|
||
|
||
# 知识库问答
|
||
kscli chat \
|
||
--message "什么是RAG?" \
|
||
--agent-id <your-agent-id> \
|
||
--workspace-id <your-workspace-id>
|
||
```
|
||
|
||
## 命令列表
|
||
|
||
| 命令 | 说明 |
|
||
| :------------ | :------------------------------------ |
|
||
| `search` | 知识库语义检索(RAG) |
|
||
| `chat` | 知识库问答(流式输出) |
|
||
| `retrieve` | 查询知识库(已弃用,请使用 `search`) |
|
||
| `config show` | 显示当前配置 |
|
||
| `config set` | 设置配置项 |
|
||
| `update` | 自更新到最新版本 |
|
||
|
||
## 认证方式
|
||
|
||
推荐使用 DashScope API Key 进行认证。前往 [DashScope 控制台](https://bailian.console.aliyun.com/?tab=app#/api-key) 获取。
|
||
|
||
```bash
|
||
# 方式一:环境变量
|
||
export DASHSCOPE_API_KEY=sk-xxxxx
|
||
|
||
# 方式二:登录命令(持久化到 ~/.bailian/config.json)
|
||
kscli config set --key api_key --value sk-xxxxx
|
||
|
||
# 方式三:命令行参数
|
||
kscli search --api-key sk-xxxxx --query "..." --agent-id <id> --workspace-id <id>
|
||
```
|
||
|
||
## 配置
|
||
|
||
```bash
|
||
# 查看当前配置
|
||
kscli config show
|
||
|
||
# 设置默认值
|
||
kscli config set --key base_url --value https://dashscope-us.aliyuncs.com
|
||
kscli config set --key timeout --value 600
|
||
|
||
# 自更新
|
||
kscli update
|
||
```
|
||
|
||
配置文件位置:`~/.bailian/config.json`
|
||
|
||
## 相关链接
|
||
|
||
| 资源 | 地址 |
|
||
| :---------------------- | :--------------------------------------------------- |
|
||
| Knowledge Studio 控制台 | https://rag.console.aliyun.com/ |
|
||
| DashScope API 文档 | https://help.aliyun.com/zh/model-studio/ |
|
||
| 获取 API Key | https://bailian.console.aliyun.com/?tab=app#/api-key |
|
||
|
||
## 参与贡献
|
||
|
||
欢迎提 Issue、Feature Request 和 PR。开发环境搭建与贡献流程请见 [CONTRIBUTING.zh.md](https://github.com/modelstudioai/cli/blob/main/CONTRIBUTING.zh.md)。
|
||
|
||
## 许可证
|
||
|
||
[Apache 2.0](LICENSE)
|