@comate/zulu 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -0
- package/comate-engine/bin/comate.js +32 -1
- package/comate-engine/node_modules/@comate/plugin-engine/dist/index.js +15 -7
- package/comate-engine/node_modules/@comate/plugin-host/dist/index.js +1 -1
- package/comate-engine/node_modules/@comate/plugin-host/dist/main.js +1 -1
- package/comate-engine/node_modules/@comate/plugin-host/dist/{user-Btg63hPI.js → user-tNVx6ovK.js} +15 -7
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.d.ts +63 -4
- package/comate-engine/node_modules/@comate/plugin-shared-internals/dist/index.js +15 -7
- package/comate-engine/node_modules/@comate/plugin-shared-internals/package.json +1 -0
- package/comate-engine/package.json +3 -0
- package/comate-engine/plugins/demo-feature/dist/index.js +17204 -0
- package/comate-engine/plugins/devaux/dist/index.js +203 -0
- package/comate-engine/plugins/f2c/dist/index.js +17204 -0
- package/comate-engine/plugins/xiaomi-aiot/dist/index.js +17204 -0
- package/comate-engine/server.js +17 -17
- package/dist/bundle/index.js +2 -2
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
# Zulu CLI
|
|
2
|
+
|
|
3
|
+
## 环境
|
|
4
|
+
* nodejs >= 22
|
|
5
|
+
* ripgrep >= 12 需要手动安装该库
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
### 安装 ripgrep
|
|
9
|
+
以下是在不同操作系统和包管理器中安装`ripgrep`的常见命令:
|
|
10
|
+
#### MacOS
|
|
11
|
+
```shell
|
|
12
|
+
brew install ripgrep
|
|
13
|
+
```
|
|
14
|
+
#### Linux
|
|
15
|
+
##### Ubuntu/Debian
|
|
16
|
+
```shell
|
|
17
|
+
sudo apt update
|
|
18
|
+
sudo apt install ripgrep
|
|
19
|
+
```
|
|
20
|
+
##### CentOS
|
|
21
|
+
```shell
|
|
22
|
+
sudo yum install epel-release
|
|
23
|
+
sudo yum install ripgrep
|
|
24
|
+
```
|
|
25
|
+
#### Windows
|
|
26
|
+
```shell
|
|
27
|
+
winget install BurntSushi.ripgrep.MSVC
|
|
28
|
+
```
|
|
29
|
+
#### 验证安装
|
|
30
|
+
安装完成后,可以使用以下命令验证:
|
|
31
|
+
```shell
|
|
32
|
+
rg --version
|
|
33
|
+
```
|
|
34
|
+
选择适合你操作系统和包管理器的命令即可。推荐使用系统自带的包管理器,这样更容易管理和更新。
|
|
35
|
+
|
|
36
|
+
### 安装 Zulu-CLI
|
|
37
|
+
```shell
|
|
38
|
+
npm install -g @comate/zulu
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## 网络
|
|
42
|
+
默认请求`https://comate.baidu.com`,如果环境未知,请执行`zulu --ping`测试连通性,如果不通:
|
|
43
|
+
|
|
44
|
+
* 厂内用户可以使用export HTTP_HOST="https://comate-saas-proxy.now.baidu-int.com"修改默认请求的域名
|
|
45
|
+
* 私有服务或者其他特殊场景可以设置export HTTP_HOST="xxxx"其他zulu支持的域名
|
|
46
|
+
|
|
47
|
+
## 使用
|
|
48
|
+
```shell
|
|
49
|
+
zulu run --query="你好" --license=xxxx
|
|
50
|
+
```
|
|
51
|
+
命令执行后会以`STDOUT`形式返回模型完整的JSON数据日志,文件操作直接应用到文件
|
|
52
|
+
|
|
53
|
+
## Command
|
|
54
|
+
|
|
55
|
+
| command | 是否必须 | option | 描述 |
|
|
56
|
+
|:---|:---|:---|:---|
|
|
57
|
+
| run | 是 | --license | license的值 |
|
|
58
|
+
| run | 是 | --query | 问题的内容 |
|
|
59
|
+
| run | | --cwd | 工作路径,默认执行时所在地址 |
|
|
60
|
+
| run | | --ripgrep | ripgrep的绝对路径 |
|
|
61
|
+
| | | --ping | 测试网络连通性 |
|
|
62
|
+
| | | --help | 帮助 |
|
|
63
|
+
| | | --version | 版本号 |
|
|
64
|
+
|
|
65
|
+
## Env
|
|
66
|
+
|
|
67
|
+
| key | value | 描述 |
|
|
68
|
+
|:---|:---|:---|
|
|
69
|
+
| HTTP_PROXY | string | 设置代理 |
|
|
70
|
+
| http_proxy | string | 设置代理 |
|
|
71
|
+
| HTTPS_PROXY | string | 设置代理 |
|
|
72
|
+
| https_proxy | string | 设置代理 |
|
|
73
|
+
| HTTP_HOST | string | 设置服务地址,默认是 https://comate.baidu.com |
|
|
74
|
+
| DEBUG | boolean | 打开调试日志 |
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
## 调试
|
|
78
|
+
* 使用环境变量`DEBUG=true`,`STDOUT`会显示debug级别的日志
|
|
79
|
+
* `~/.comate-engine/store`中获取对应轮次对话的详细日志
|
|
80
|
+
|
|
81
|
+
## 最佳实践
|
|
82
|
+
* 请注意,`Zulu CLI`使用`Turbo`模式,黑名单是空,这也意味着`Zulu`会默认执行所以指令,请注意安全风险
|
|
83
|
+
* 目前版本只支持单轮次对话,请尽量准确描述任务
|
|
84
|
+
|
|
85
|
+
## Dockerfile
|
|
86
|
+
```dockerfile
|
|
87
|
+
FROM node:current-alpine3.22
|
|
88
|
+
|
|
89
|
+
# 安装 ripgrep
|
|
90
|
+
RUN apk add --no-cache ripgrep
|
|
91
|
+
|
|
92
|
+
# 全局安装 @comate/zulu-cli
|
|
93
|
+
RUN npm install -g @comate/zulu
|
|
94
|
+
|
|
95
|
+
WORKDIR /app
|
|
96
|
+
|
|
97
|
+
CMD ["zulu", "--help"]
|
|
98
|
+
```
|
|
@@ -1,10 +1,41 @@
|
|
|
1
1
|
// ================ polyfill start ================
|
|
2
|
-
import {
|
|
2
|
+
import {compare} from 'compare-versions';
|
|
3
3
|
if (compare(process.version, '18.0.0', '<')) {
|
|
4
4
|
await import('web-streams-polyfill/polyfill');
|
|
5
5
|
}
|
|
6
6
|
// ================= polyfill end =================
|
|
7
7
|
|
|
8
|
+
// TODO 重定向到日志系统
|
|
9
|
+
[
|
|
10
|
+
'log',
|
|
11
|
+
'info',
|
|
12
|
+
'warn',
|
|
13
|
+
'error',
|
|
14
|
+
'debug',
|
|
15
|
+
'trace',
|
|
16
|
+
'dir',
|
|
17
|
+
'dirxml',
|
|
18
|
+
'table',
|
|
19
|
+
'time',
|
|
20
|
+
'timeEnd',
|
|
21
|
+
'timeLog',
|
|
22
|
+
'timeStamp',
|
|
23
|
+
'group',
|
|
24
|
+
'groupCollapsed',
|
|
25
|
+
'groupEnd',
|
|
26
|
+
'count',
|
|
27
|
+
'countReset',
|
|
28
|
+
'clear',
|
|
29
|
+
'assert',
|
|
30
|
+
'profile',
|
|
31
|
+
'profileEnd',
|
|
32
|
+
]
|
|
33
|
+
.forEach(key => {
|
|
34
|
+
console[key] = function () {
|
|
35
|
+
// nothing to do
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
8
39
|
// 通过await import延迟加载,使得polyfill在主模块之前执行
|
|
9
40
|
const {run} = await import('../server.js');
|
|
10
41
|
run();
|