mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-07-14 22:52:15 +02:00
feat(model-connections): enhance model connection functionality with preview and selection features
This commit is contained in:
parent
356f0e56c5
commit
407f2a9612
20 changed files with 630 additions and 429 deletions
|
|
@ -1,4 +1,4 @@
|
|||
import type { ModelRead } from "@/contracts/types/model-connections.types";
|
||||
import type { ModelPreviewRead, ModelRead } from "@/contracts/types/model-connections.types";
|
||||
|
||||
export type ModelCapabilityFilter = "chat" | "vision" | "image_gen";
|
||||
|
||||
|
|
@ -8,17 +8,22 @@ export const MODEL_CAPABILITY_FILTERS: { key: ModelCapabilityFilter; label: stri
|
|||
{ key: "image_gen", label: "Image" },
|
||||
];
|
||||
|
||||
export function modelLabel(model: ModelRead) {
|
||||
export type SelectableModel = (ModelRead | ModelPreviewRead) & {
|
||||
id?: number | string;
|
||||
connection_id?: number;
|
||||
};
|
||||
|
||||
export function modelLabel(model: SelectableModel) {
|
||||
return model.display_name || model.model_id;
|
||||
}
|
||||
|
||||
export function capability(model: ModelRead, key: ModelCapabilityFilter) {
|
||||
export function capability(model: SelectableModel, key: ModelCapabilityFilter) {
|
||||
if (key === "chat") return Boolean(model.supports_chat);
|
||||
if (key === "vision") return Boolean(model.supports_image_input);
|
||||
return Boolean(model.supports_image_generation);
|
||||
}
|
||||
|
||||
export function capabilityLabels(model: ModelRead) {
|
||||
export function capabilityLabels(model: SelectableModel) {
|
||||
return MODEL_CAPABILITY_FILTERS.filter((filter) => capability(model, filter.key))
|
||||
.map((filter) => filter.label.toLowerCase())
|
||||
.join(", ");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue