mirror of
https://github.com/ChatGPTNextWeb/NextChat.git
synced 2026-03-02 16:23:23 +08:00
feat: add multi-model support
This commit is contained in:
28
app/client/core.ts
Normal file
28
app/client/core.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { MaskConfig, ProviderConfig } from "../store";
|
||||
import { shareToShareGPT } from "./common/share";
|
||||
import { createOpenAiClient } from "./openai";
|
||||
import { ChatControllerPool } from "./common/controller";
|
||||
|
||||
export const LLMClients = {
|
||||
openai: createOpenAiClient,
|
||||
};
|
||||
|
||||
export function createLLMClient(
|
||||
config: ProviderConfig,
|
||||
maskConfig: MaskConfig,
|
||||
) {
|
||||
return LLMClients[maskConfig.provider as any as keyof typeof LLMClients](
|
||||
config,
|
||||
maskConfig.modelConfig,
|
||||
);
|
||||
}
|
||||
|
||||
export function createApi() {
|
||||
return {
|
||||
createLLMClient,
|
||||
shareToShareGPT,
|
||||
controllerManager: ChatControllerPool,
|
||||
};
|
||||
}
|
||||
|
||||
export const api = createApi();
|
||||
Reference in New Issue
Block a user