Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,16 @@ export type ClassifyModelImportInput = {

export type ModelImportOutcome = "no-models" | "nothing-new" | "import";

/** A model entry as discovery returns it; the id may be under any of these keys. */
export type DiscoveredModel = { id?: unknown; name?: unknown; model?: unknown };
/**
* A model entry as discovery returns it; the id may be under any of these keys. The rest of the
* entry (apiFormat, dimensions, inputTokenLimit, …) is forwarded to the import call as-is.
*/
export type DiscoveredModel = {
id?: unknown;
name?: unknown;
model?: unknown;
[field: string]: unknown;
};

export type ModelImportClassification = {
outcome: ModelImportOutcome;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,9 @@ export function useModelImportHandlers({
const failures: string[] = [];
for (let i = 0; i < newModels.length; i++) {
const model = newModels[i];
const modelId = model.id || model.name || model.model;
const rawId = model.id || model.name || model.model;
// Same coercion classifyModelImport uses for the "already imported" check.
const modelId = typeof rawId === "string" ? rawId : String(rawId ?? "");
if (!modelId) continue;
const parts = modelId.split("/");
const baseAlias = parts[parts.length - 1];
Expand Down
5 changes: 4 additions & 1 deletion src/shared/components/compression/engineConfigSave.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ export function buildEngineDetailUpdate(
return {
compressToolResults: next.compressToolResults !== false,
...("maxToolLength" in next
? { maxToolLength: typeof cap === "number" && Number.isNaN(cap) ? null : Math.floor(cap) }
? {
maxToolLength:
typeof cap === "number" && Number.isNaN(cap) ? null : Math.floor(Number(cap)),
}
: {}),
};
}
Expand Down
Loading