Initial commit
This commit is contained in:
35
src/sse/services/model.js
Normal file
35
src/sse/services/model.js
Normal file
@@ -0,0 +1,35 @@
|
||||
// Re-export from open-sse with localDb integration
|
||||
import { getModelAliases, getComboByName } from "@/lib/localDb";
|
||||
import { parseModel, resolveModelAliasFromMap, getModelInfoCore } from "open-sse/services/model.js";
|
||||
|
||||
export { parseModel };
|
||||
|
||||
/**
|
||||
* Resolve model alias from localDb
|
||||
*/
|
||||
export async function resolveModelAlias(alias) {
|
||||
const aliases = await getModelAliases();
|
||||
return resolveModelAliasFromMap(alias, aliases);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get full model info (parse or resolve)
|
||||
*/
|
||||
export async function getModelInfo(modelStr) {
|
||||
return getModelInfoCore(modelStr, getModelAliases);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if model is a combo and get models list
|
||||
* @returns {Promise<string[]|null>} Array of models or null if not a combo
|
||||
*/
|
||||
export async function getComboModels(modelStr) {
|
||||
// Only check if it's not in provider/model format
|
||||
if (modelStr.includes("/")) return null;
|
||||
|
||||
const combo = await getComboByName(modelStr);
|
||||
if (combo && combo.models && combo.models.length > 0) {
|
||||
return combo.models;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user