mirror of
https://github.com/bytedance/deer-flow.git
synced 2026-05-23 00:16:48 +00:00
b103d1a7f5
* feat(frontend): support static website demo mode * fix(frontend): render html artifact previews from blob content * chore(frontend): apply pre-commit formatting * fix(frontend): address static demo PR review comments * Update the release information of DeerFlow --------- Co-authored-by: Willem Jiang <willem.jiang@gmail.com>
23 lines
617 B
TypeScript
23 lines
617 B
TypeScript
import { getBackendBaseURL } from "../config";
|
|
import { isStaticWebsiteOnly } from "../static-mode";
|
|
|
|
import type { ModelsResponse } from "./types";
|
|
|
|
const STATIC_MODELS_RESPONSE: ModelsResponse = {
|
|
models: [],
|
|
token_usage: { enabled: false },
|
|
};
|
|
|
|
export async function loadModels(): Promise<ModelsResponse> {
|
|
if (isStaticWebsiteOnly()) {
|
|
return STATIC_MODELS_RESPONSE;
|
|
}
|
|
|
|
const res = await fetch(`${getBackendBaseURL()}/api/models`);
|
|
const data = (await res.json()) as Partial<ModelsResponse>;
|
|
return {
|
|
models: data.models ?? [],
|
|
token_usage: data.token_usage ?? { enabled: false },
|
|
};
|
|
}
|