feat: support moonshot ai (#107)

This commit is contained in:
Zhang Minghan 2024-03-12 15:08:11 +08:00
parent 422da58b24
commit 0ecd49e312
6 changed files with 55 additions and 25 deletions

View File

@ -35,6 +35,8 @@ var channelFactories = map[string]adaptercommon.FactoryCreator{
globals.SkylarkChannelType: skylark.NewChatInstanceFromConfig, globals.SkylarkChannelType: skylark.NewChatInstanceFromConfig,
globals.ZhinaoChannelType: zhinao.NewChatInstanceFromConfig, globals.ZhinaoChannelType: zhinao.NewChatInstanceFromConfig,
globals.MidjourneyChannelType: midjourney.NewChatInstanceFromConfig, globals.MidjourneyChannelType: midjourney.NewChatInstanceFromConfig,
globals.MoonshotChannelType: openai.NewChatInstanceFromConfig, // openai format
} }
func createChatRequest(conf globals.ChannelConfig, props *adaptercommon.ChatProps, hook globals.Hook) error { func createChatRequest(conf globals.ChannelConfig, props *adaptercommon.ChatProps, hook globals.Hook) error {

View File

@ -36,7 +36,8 @@ export const ChannelTypes: Record<string, string> = {
palm: "Google Gemini", palm: "Google Gemini",
midjourney: "Midjourney Proxy", midjourney: "Midjourney Proxy",
sparkdesk: "讯飞星火 SparkDesk", sparkdesk: "讯飞星火 SparkDesk",
chatglm: "智谱 ChatGLM", chatglm: "智谱清言 ChatGLM",
moonshot: "月之暗面 Moonshot",
qwen: "通义千问 TongYi", qwen: "通义千问 TongYi",
hunyuan: "腾讯混元 Hunyuan", hunyuan: "腾讯混元 Hunyuan",
zhinao: "360智脑 360GLM", zhinao: "360智脑 360GLM",
@ -207,6 +208,11 @@ export const ChannelInfos: Record<string, ChannelInfo> = {
"> 接入点填写你的 Midjourney Proxy 的部署地址,如 *http://localhost:8080*, *https://example.com* \n" + "> 接入点填写你的 Midjourney Proxy 的部署地址,如 *http://localhost:8080*, *https://example.com* \n" +
"> 注意:**请在系统设置中设置后端的公网 IP / 域名,否则无法接收回调报错 please provide available notify url** \n", "> 注意:**请在系统设置中设置后端的公网 IP / 域名,否则无法接收回调报错 please provide available notify url** \n",
}, },
moonshot: {
endpoint: "https://api.moonshot.cn",
format: "<api-key>",
models: ["moonshot-v1-8k", "moonshot-v1-32k", "moonshot-v1-128k"],
}
}; };
export const defaultChannelModels: string[] = getUniqueList( export const defaultChannelModels: string[] = getUniqueList(

View File

@ -46,6 +46,10 @@ export const modelColorMapper: Record<string, string> = {
"spark-desk-v3": "blue-400", "spark-desk-v3": "blue-400",
"spark-desk-v3.5": "blue-400", "spark-desk-v3.5": "blue-400",
"moonshot-v1-8k": "black-500",
"moonshot-v1-32k": "black-500",
"moonshot-v1-128k": "black-500",
"chat-bison-001": "red-500", "chat-bison-001": "red-500",
"gemini-pro": "red-500", "gemini-pro": "red-500",
"gemini-pro-vision": "red-500", "gemini-pro-vision": "red-500",

View File

@ -119,38 +119,56 @@ export const pricing: PricingDataset = [
}, },
{ {
models: ["spark-desk-v1.5"], models: ["spark-desk-v1.5"],
input: 0.15, input: 0.015,
output: 0.15, output: 0.015,
currency: Currency.CNY, currency: Currency.CNY,
}, },
{ {
models: ["spark-desk-v2", "spark-desk-v3"], models: ["spark-desk-v2", "spark-desk-v3"],
input: 0.3, input: 0.03,
output: 0.3, output: 0.03,
currency: Currency.CNY,
},
{
models: ["moonshot-v1-8k"],
input: 0.012,
output: 0.012,
currency: Currency.CNY,
},
{
models: ["moonshot-v1-32k"],
input: 0.024,
output: 0.024,
currency: Currency.CNY,
},
{
models: ["moonshot-v1-128k"],
input: 0.06,
output: 0.06,
currency: Currency.CNY, currency: Currency.CNY,
}, },
{ {
models: ["zhipu-chatglm-lite", "zhipu-chatglm-std", "zhipu-chatglm-turbo"], models: ["zhipu-chatglm-lite", "zhipu-chatglm-std", "zhipu-chatglm-turbo"],
input: 0.05, input: 0.005,
output: 0.05, output: 0.005,
currency: Currency.CNY, currency: Currency.CNY,
}, },
{ {
models: ["zhipu-chatglm-pro"], models: ["zhipu-chatglm-pro"],
input: 0.1, input: 0.01,
output: 0.1, output: 0.01,
currency: Currency.CNY, currency: Currency.CNY,
}, },
{ {
models: ["qwen-plus", "qwen-plus-net"], models: ["qwen-plus", "qwen-plus-net"],
input: 0.2, input: 0.02,
output: 0.2, output: 0.02,
currency: Currency.CNY, currency: Currency.CNY,
}, },
{ {
models: ["qwen-turbo", "qwen-turbo-net"], models: ["qwen-turbo", "qwen-turbo-net"],
input: 0.08, input: 0.008,
output: 0.08, output: 0.008,
currency: Currency.CNY, currency: Currency.CNY,
}, },
{ {
@ -164,8 +182,8 @@ export const pricing: PricingDataset = [
}, },
{ {
models: ["hunyuan"], models: ["hunyuan"],
input: 1, input: 0.1,
output: 1, output: 0.1,
currency: Currency.CNY, currency: Currency.CNY,
}, },
{ {
@ -176,26 +194,26 @@ export const pricing: PricingDataset = [
}, },
{ {
models: ["baichuan-53b"], models: ["baichuan-53b"],
input: 0.2, input: 0.02,
output: 0.2, output: 0.02,
currency: Currency.CNY, currency: Currency.CNY,
}, },
{ {
models: ["skylark-lite-public"], models: ["skylark-lite-public"],
input: 0.04, input: 0.004,
output: 0.04, output: 0.004,
currency: Currency.CNY, currency: Currency.CNY,
}, },
{ {
models: ["skylark-plus-public"], models: ["skylark-plus-public"],
input: 0.08, input: 0.008,
output: 0.08, output: 0.008,
currency: Currency.CNY, currency: Currency.CNY,
}, },
{ {
models: ["skylark-pro-public", "skylark-chat"], models: ["skylark-pro-public", "skylark-chat"],
input: 0.11, input: 0.011,
output: 0.11, output: 0.011,
currency: Currency.CNY, currency: Currency.CNY,
}, },
]; ];

View File

@ -686,7 +686,7 @@ function ChargeTable({ data, dispatch, onRefresh }: ChargeTableProps) {
dispatch({ type: "set", payload: props }); dispatch({ type: "set", payload: props });
// scroll to top // scroll to top
scrollUp(getQuerySelector(".admin-content")!); scrollUp(getQuerySelector(".admin-content > .scrollarea-viewport")!);
}} }}
> >
<Settings2 className={`h-4 w-4`} /> <Settings2 className={`h-4 w-4`} />

View File

@ -23,7 +23,7 @@ const (
BingChannelType = "bing" BingChannelType = "bing"
PalmChannelType = "palm" PalmChannelType = "palm"
MidjourneyChannelType = "midjourney" MidjourneyChannelType = "midjourney"
OneAPIChannelType = "oneapi" MoonshotChannelType = "moonshot"
) )
const ( const (