allow change model name

This commit is contained in:
Archeb
2024-05-15 13:35:00 +08:00
parent 2c8e7b845a
commit 9d6cde125c
4 changed files with 54 additions and 4 deletions
+2 -2
View File
@@ -23,9 +23,9 @@ A proxy for YOU Chat.
## Limitations 限制
Only Anthropic API format is supported. The model is hardcoded Claude 3 Opus.
Only Anthropic API format is supported. Change the model name to use different models (default claude_3_opus)
只支持A社的API格式,模型是写死了的 Claude 3 Opus
只支持A社的API格式,默认模型为 claude_3_opus
Messages will be squashed into question: ... answer: ... format.
+2 -2
View File
@@ -6,7 +6,7 @@ const { ProxyAgent } = require("proxy-agent");
const agent = new ProxyAgent();
const app = express();
const axios = require("axios");
const port = 8080;
const port = process.env.PORT || 8080;
const validApiKey = process.env.PASSWORD;
// import config.js
@@ -167,7 +167,7 @@ app.post("/v1/messages", apiKeyAuth, (req, res) => {
chatId: traceId,
traceId: `${traceId}|${msgid}|${new Date().toISOString()}`,
conversationTurnId: msgid,
selectedAiModel: "claude_3_opus",
selectedAiModel: process.env.AI_MODEL || "claude_3_opus",
selectedChatMode: "custom",
pastChatLength: userMessage.length,
queryTraceId: traceId,
+2
View File
@@ -1,5 +1,7 @@
call npm install
set PASSWORD=
set https_proxy=
set PORT=8080
set AI_MODEL=claude_3_opus
node index
pause
+48
View File
@@ -35,6 +35,8 @@ module.exports = {
(可选)如果需要,可以设置代理。
(可选)如果需要,可以修改使用的模型。但是仍然建议使用opus,因为其他未经测试。
8. 启动 start.bat
9. 酒馆中选择 Claude,反向代理地址填 http://127.0.0.1:8080/v1 **反代密码必须填, 同时打开流式传输**,随便什么都可以(除非你在第7步设置了PASSWORD)。
@@ -49,6 +51,27 @@ module.exports = {
欲知详细代理格式,请查阅 https://www.npmjs.com/package/proxy-from-env
# 修改模型
修改`AI_MODEL`环境变量可以切换模型,支持的模型名字如下 (请参考官网获取最新模型):
```
gpt_4o
gpt_4_turbo
gpt_4
claude_3_opus
claude_3_sonnet
claude_3_haiku
claude_2
llama3
gemini_pro
gemini_1_5_pro
databricks_dbrx_instruct
command_r
command_r_plus
zephyr
```
## 注意事项
出现 403 错误请重新抓 COOKIE 或者更换代理出口 IP。
@@ -91,6 +114,8 @@ module.exports = {
(Optional) You can set the proxy in start.bat. See below.
(Optional) You may change the model to use, but only claude_3_opus is tested.
8. Start start.bat
9. Select Claude in the Tavern and put http://127.0.0.1:8080/v1 as the address of the reverse proxy. **Use any random string for password, also turn on Streaming** (unless you set PASSWORD in step 7).
@@ -101,6 +126,29 @@ module.exports = {
Use the `https_proxy` env to set custom proxy. Refer to https://www.npmjs.com/package/proxy-from-env for detail.
# Change model
Change `AI_MODEL` env to switch between models.
Supported model names (refer to you.com website for latest models):
```
gpt_4o
gpt_4_turbo
gpt_4
claude_3_opus
claude_3_sonnet
claude_3_haiku
claude_2
llama3
gemini_pro
gemini_1_5_pro
databricks_dbrx_instruct
command_r
command_r_plus
zephyr
```
## Caution
If you get 403 errors, consider getting the cookie again or changing your IP.