|
import { IModelInfo } from './interface';
|
|
import axios from 'axios';
|
|
|
|
|
|
export const EndPoint = {
|
|
BING_SEARCH_V7_ENDPOINT: 'https://api.bing.microsoft.com/v7.0/search',
|
|
GOOGLE_SEARCH_ENDPOINT: 'https://www.googleapis.com/customsearch/v1'
|
|
};
|
|
|
|
export const BING_MKT = 'en-US';
|
|
|
|
|
|
export const DEFAULT_SEARCH_ENGINE_TIMEOUT = 20000;
|
|
|
|
|
|
export const DefaultQuery = 'Who said \'live long and prosper';
|
|
export const DefaultSystem = 'You are a helpful assistant.';
|
|
|
|
|
|
async function fetchOpenAIModels(): Promise<string[]> {
|
|
try {
|
|
const response = await axios.get('https://api.deem.love/v1/models');
|
|
const data = response.data;
|
|
return data.data.map((model: { id: string }) => model.id);
|
|
} catch (error) {
|
|
console.error('获取模型列表失败:', error);
|
|
return [];
|
|
}
|
|
}
|
|
|
|
|
|
export let Models: IModelInfo[] = [
|
|
{
|
|
platform: 'aliyun',
|
|
type: '',
|
|
models: ['qwen-max', 'qwen-max-1201', 'qwen-turbo', 'qwen-plus']
|
|
},
|
|
{
|
|
platform: 'openai',
|
|
type: 'openai',
|
|
|
|
models: []
|
|
},
|
|
{
|
|
platform: 'baidu',
|
|
type: 'baidu',
|
|
models: ['eb-instant', 'completions_pro', 'ernie_bot_8k']
|
|
},
|
|
{
|
|
platform: 'google',
|
|
type: 'gemini',
|
|
models: ['gemini-pro', 'gemini-1.5-pro-latest']
|
|
},
|
|
{
|
|
platform: 'yi',
|
|
type: 'openai',
|
|
models: ['yi-34b-chat-0205', 'yi-34b-chat-200k']
|
|
},
|
|
{
|
|
platform: 'moonshot',
|
|
type: 'openai',
|
|
models: ['moonshot-v1-8k', 'moonshot-v1-32k', 'moonshot-v1-128k']
|
|
},
|
|
{
|
|
platform: 'lepton',
|
|
type: 'openai',
|
|
models: ['llama2-7b', 'llama2-13b', 'llama2-70b', 'mixtral-8*7b', 'mixtral-8*22b']
|
|
},
|
|
{
|
|
platform: 'deepseek',
|
|
type: 'openai',
|
|
models: ['deepseek-chat', 'deepseek-coder']
|
|
},
|
|
{
|
|
platform: 'chatglm',
|
|
type: 'openai',
|
|
models: ['glm-4', 'glm-4v', 'glm-3-turbo']
|
|
},
|
|
{
|
|
platform: 'tencent',
|
|
type: 'tencent',
|
|
models: ['std', 'pro']
|
|
}
|
|
];
|
|
|
|
|
|
export async function initializeModels() {
|
|
const openAIModels = await fetchOpenAIModels();
|
|
Models = Models.map(platform => {
|
|
if (platform.platform === 'openai') {
|
|
return { ...platform, models: openAIModels };
|
|
}
|
|
return platform;
|
|
});
|
|
} |