ai-chatbot/lib/worldlabs/key-pool-config.ts
Your Name b3b49b4fe2
Some checks failed
Lint / build (20) (push) Has been cancelled
Playwright Tests / test (push) Has been cancelled
feat: improve worldlabs admin controls and splat selection
2026-04-05 23:42:37 +08:00

30 lines
789 B
TypeScript

import "server-only";
import { getSystemSetting } from "@/lib/db/queries";
import {
defaultWorldLabsKeyPoolConfig,
normalizeWorldLabsKeyPoolConfig,
WORLDLABS_KEY_POOL_CONFIG_KEY,
type WorldLabsKeyPoolConfig,
} from "@/lib/worldlabs/key-pool-config-shared";
export {
defaultWorldLabsKeyPoolConfig,
normalizeWorldLabsKeyPoolConfig,
WORLDLABS_KEY_POOL_CONFIG_KEY,
type WorldLabsKeyPoolConfig,
};
export async function getWorldLabsKeyPoolConfig(): Promise<WorldLabsKeyPoolConfig> {
try {
const setting = await getSystemSetting({
key: WORLDLABS_KEY_POOL_CONFIG_KEY,
});
return setting?.value
? normalizeWorldLabsKeyPoolConfig(setting.value)
: defaultWorldLabsKeyPoolConfig;
} catch (_error) {
return defaultWorldLabsKeyPoolConfig;
}
}