shitton
This commit is contained in:
+24
-1
@@ -1,4 +1,5 @@
|
||||
import {Ollama} from "ollama";
|
||||
import {z} from "zod";
|
||||
|
||||
export function asNonEmptyString(value: unknown): string | undefined {
|
||||
return typeof value === "string" && value.trim().length > 0
|
||||
@@ -78,7 +79,7 @@ export async function unloadAllOllamaModels(ollama: Ollama, exceptFor?: string[]
|
||||
);
|
||||
|
||||
await Promise.all(unloadPromises);
|
||||
console.log("All models have been requested to unload" + exceptFor?.length ? ` except for [${exceptFor?.join(", ")}].` : ".");
|
||||
console.log("All models have been requested to unload" + (exceptFor?.length ? ` except for [${exceptFor?.join(", ")}].` : "."));
|
||||
} catch (error) {
|
||||
console.error("Error unloading models:", error);
|
||||
}
|
||||
@@ -100,3 +101,25 @@ export async function loadOllamaModel(model: string, ollama: Ollama, contextLeng
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export type ToolPlanStep = {
|
||||
t: string;
|
||||
h: string;
|
||||
from: string;
|
||||
};
|
||||
|
||||
export type RouterPlan = {
|
||||
s: ToolPlanStep[];
|
||||
m: string;
|
||||
};
|
||||
|
||||
export const ToolPlanStepSchema = z.object({
|
||||
t: z.string(),
|
||||
h: z.string(),
|
||||
from: z.string(),
|
||||
});
|
||||
|
||||
export const RouterPlanSchema = z.object({
|
||||
s: z.array(ToolPlanStepSchema),
|
||||
m: z.string()
|
||||
});
|
||||
Reference in New Issue
Block a user