add moonshot api

This commit is contained in:
lloydzhou
2024-08-01 11:55:22 +08:00
parent f5499ff699
commit 40cbabc330
7 changed files with 460 additions and 0 deletions

View File

@@ -22,6 +22,7 @@ export const BAIDU_OATUH_URL = `${BAIDU_BASE_URL}/oauth/2.0/token`;
export const BYTEDANCE_BASE_URL = "https://ark.cn-beijing.volces.com";
export const ALIBABA_BASE_URL = "https://dashscope.aliyuncs.com/api/";
export const MOONSHOT_BASE_URL = "https://api.moonshot.cn";
export const CACHE_URL_PREFIX = "/api/cache";
export const UPLOAD_URL = `${CACHE_URL_PREFIX}/upload`;
@@ -46,6 +47,7 @@ export enum ApiPath {
Baidu = "/api/baidu",
ByteDance = "/api/bytedance",
Alibaba = "/api/alibaba",
Moonshot = "/api/moonshot",
Stability = "/api/stability",
}
@@ -94,6 +96,7 @@ export enum ServiceProvider {
Baidu = "Baidu",
ByteDance = "ByteDance",
Alibaba = "Alibaba",
Moonshot = "Moonshot",
Stability = "Stability",
}
@@ -114,6 +117,7 @@ export enum ModelProvider {
Ernie = "Ernie",
Doubao = "Doubao",
Qwen = "Qwen",
Moonshot = "Moonshot",
}
export const Stability = {
@@ -177,6 +181,11 @@ export const Alibaba = {
ChatPath: "v1/services/aigc/text-generation/generation",
};
export const Moonshot = {
ExampleEndpoint: MOONSHOT_BASE_URL,
ChatPath: "v1/chat/completions",
};
export const DEFAULT_INPUT_TEMPLATE = `{{input}}`; // input / time / model / lang
// export const DEFAULT_SYSTEM_TEMPLATE = `
// You are ChatGPT, a large language model trained by {{ServiceProvider}}.
@@ -283,6 +292,8 @@ const alibabaModes = [
"qwen-max-longcontext",
];
const moonshotModes = ["moonshot-v1-8k", "moonshot-v1-32k", "moonshot-v1-128k"];
export const DEFAULT_MODELS = [
...openaiModels.map((name) => ({
name,
@@ -347,6 +358,15 @@ export const DEFAULT_MODELS = [
providerType: "alibaba",
},
})),
...moonshotModes.map((name) => ({
name,
available: true,
provider: {
id: "moonshot",
providerName: "Moonshot",
providerType: "moonshot",
},
})),
] as const;
export const CHAT_PAGE_SIZE = 15;