xiaozhou-chat 1.0.0 → 1.0.1
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 +119 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,28 +1,137 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
# xiaozhou-chat
|
|
2
3
|
|
|
3
4
|
CLI chatbot based on NewAPI.
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## ✨ 特性
|
|
9
|
+
- 基于 NewAPI 的命令行聊天工具
|
|
10
|
+
- 支持自定义模型与 Base URL
|
|
11
|
+
- 自动保存历史记录
|
|
12
|
+
- Node.js 18+ 支持
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 📦 安装
|
|
17
|
+
|
|
18
|
+
全局安装:
|
|
19
|
+
```bash
|
|
20
|
+
npm i -g xiaozhou-chat
|
|
21
|
+
```
|
|
7
22
|
|
|
8
|
-
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## ⚙️ 配置
|
|
26
|
+
|
|
27
|
+
### 环境变量(推荐)
|
|
28
|
+
必填:
|
|
29
|
+
```bash
|
|
9
30
|
export NEWAPI_API_KEY="你的Key"
|
|
31
|
+
```
|
|
10
32
|
|
|
11
33
|
可选:
|
|
34
|
+
```bash
|
|
12
35
|
export NEWAPI_BASE_URL="https://api.newapi.pro/v1"
|
|
13
36
|
export NEWAPI_MODEL="gpt-3.5-turbo"
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 配置说明表
|
|
40
|
+
|
|
41
|
+
| 变量名 | 是否必填 | 说明 | 示例 |
|
|
42
|
+
|---|---|---|---|
|
|
43
|
+
| NEWAPI_API_KEY | 必填 | NewAPI 的 API Key | `sk-xxxx` |
|
|
44
|
+
| NEWAPI_BASE_URL | 可选 | NewAPI 请求地址 | `https://api.newapi.pro/v1` |
|
|
45
|
+
| NEWAPI_MODEL | 可选 | 默认模型 | `gpt-3.5-turbo` |
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 🚀 使用
|
|
50
|
+
|
|
51
|
+
### 基础启动
|
|
52
|
+
```bash
|
|
53
|
+
xiaozhou-chat
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### 自定义模型与地址
|
|
57
|
+
```bash
|
|
58
|
+
xiaozhou-chat --model gpt-4 --base-url https://api.newapi.pro/v1
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## 🧰 CLI 参数说明
|
|
64
|
+
|
|
65
|
+
| 参数 | 说明 | 示例 |
|
|
66
|
+
|---|---|---|
|
|
67
|
+
| --model | 指定模型 | `--model gpt-4` |
|
|
68
|
+
| --base-url | 指定 API 地址 | `--base-url https://api.newapi.pro/v1` |
|
|
69
|
+
|
|
70
|
+
---
|
|
14
71
|
|
|
15
|
-
##
|
|
16
|
-
newapi-chat
|
|
72
|
+
## 💬 使用示例
|
|
17
73
|
|
|
18
|
-
|
|
19
|
-
|
|
74
|
+
启动后输入内容即可对话:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
$ xiaozhou-chat
|
|
78
|
+
> 你好
|
|
79
|
+
你好!有什么可以帮你?
|
|
80
|
+
> 介绍一下 NewAPI
|
|
81
|
+
NewAPI 是一个兼容 OpenAI 接口的网关服务...
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
退出方式:
|
|
85
|
+
- `Ctrl + C`
|
|
86
|
+
- 或输入 `exit`
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## 📝 历史记录
|
|
20
91
|
|
|
21
|
-
## 历史记录
|
|
22
92
|
默认保存在:
|
|
93
|
+
```
|
|
23
94
|
~/.newapi-chat-history.json
|
|
95
|
+
```
|
|
24
96
|
|
|
25
|
-
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
## 🪟 Windows 打包
|
|
100
|
+
|
|
101
|
+
安装 pkg:
|
|
102
|
+
```bash
|
|
26
103
|
npm i -g pkg
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
执行打包:
|
|
107
|
+
```bash
|
|
27
108
|
npm run build:win
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
生成文件:
|
|
112
|
+
```
|
|
28
113
|
dist/newapi-chat.exe
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 🧩 脚本说明
|
|
119
|
+
|
|
120
|
+
`package.json` 中包含:
|
|
121
|
+
```json
|
|
122
|
+
"scripts": {
|
|
123
|
+
"build:win": "pkg . --targets node18-win-x64 --output dist/newapi-chat.exe"
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## 🧾 依赖
|
|
130
|
+
|
|
131
|
+
- minimist
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## 📄 许可证
|
|
136
|
+
MIT
|
|
137
|
+
```
|