update available models

This commit is contained in:
被遗忘的记忆
2024-09-06 22:57:46 +08:00
committed by GitHub
parent 5b71531315
commit 26ad55cb44
+13 -2
View File
@@ -5,6 +5,7 @@ import localtunnel from "localtunnel";
import ngrok from 'ngrok'; import ngrok from 'ngrok';
import {v4 as uuidv4} from "uuid"; import {v4 as uuidv4} from "uuid";
import './proxyAgent.mjs'; import './proxyAgent.mjs';
const app = express(); const app = express();
const port = process.env.PORT || 8080; const port = process.env.PORT || 8080;
const validApiKey = process.env.PASSWORD; const validApiKey = process.env.PASSWORD;
@@ -20,6 +21,7 @@ const availableModels = [
"llama3", "llama3",
"gemini_pro", "gemini_pro",
"gemini_1_5_pro", "gemini_1_5_pro",
"gemini_1_5_flash",
"databricks_dbrx_instruct", "databricks_dbrx_instruct",
"command_r", "command_r",
"command_r_plus", "command_r_plus",
@@ -133,7 +135,12 @@ app.post("/v1/chat/completions", OpenAIApiKeyAuth, (req, res) => {
created: Math.floor(new Date().getTime() / 1000), created: Math.floor(new Date().getTime() / 1000),
model: jsonBody.model, model: jsonBody.model,
system_fingerprint: "114514", system_fingerprint: "114514",
choices: [{ index: 0, delta: { role: "assistant", content: "" }, logprobs: null, finish_reason: null }], choices: [{
index: 0,
delta: {role: "assistant", content: ""},
logprobs: null,
finish_reason: null
}],
}) })
); );
} }
@@ -330,7 +337,11 @@ app.post("/v1/messages", AnthropicApiKeyAuth, (req, res) => {
}, },
}) })
); );
res.write(createEvent("content_block_start", { type: "content_block_start", index: 0, content_block: { type: "text", text: "" } })); res.write(createEvent("content_block_start", {
type: "content_block_start",
index: 0,
content_block: {type: "text", text: ""}
}));
res.write(createEvent("ping", {type: "ping"})); res.write(createEvent("ping", {type: "ping"}));
} }
}); });