mirror of
https://github.com/foxhui/WebAI2API.git
synced 2026-06-16 21:03:59 +08:00
feat: 初步支持 Gemini Business 并重构和整理
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { loadConfig } from '../config.js';
|
||||
import * as lmarenaBackend from './lmarena.js';
|
||||
import * as geminiBackend from './gemini_biz.js';
|
||||
|
||||
const config = loadConfig();
|
||||
|
||||
let activeBackend;
|
||||
|
||||
if (config.backend?.type === 'gemini_biz') {
|
||||
activeBackend = {
|
||||
name: 'gemini_biz',
|
||||
initBrowser: (cfg) => geminiBackend.initBrowser(cfg),
|
||||
generateImage: (ctx, prompt, paths, model, meta) => geminiBackend.generateImage(ctx, prompt, paths, model, meta),
|
||||
TEMP_DIR: geminiBackend.TEMP_DIR
|
||||
};
|
||||
} else {
|
||||
activeBackend = {
|
||||
name: 'lmarena',
|
||||
initBrowser: (cfg) => lmarenaBackend.initBrowser(cfg),
|
||||
generateImage: (ctx, prompt, paths, model, meta) => lmarenaBackend.generateImage(ctx, prompt, paths, model, meta),
|
||||
TEMP_DIR: lmarenaBackend.TEMP_DIR
|
||||
};
|
||||
}
|
||||
|
||||
export function getBackend() {
|
||||
return { config, ...activeBackend };
|
||||
}
|
||||
Reference in New Issue
Block a user