implement model management UI and backend integration for image, text, and speech models with platform-specific setup scripts
This commit is contained in:
1 parent
ba987db776
commit
45540aee29
7 files changed
+413
-157
No files matched your search
@@ -35,7 +35,8 @@ import {
|
||||
downloadTtsModel,
|
||||
deleteTtsModel,
|
||||
importTtsModel,
|
||||
getTtsStatus
|
||||
getTtsStatus,
|
||||
isLocalServerMode
|
||||
} from "../services/api";
|
||||
|
||||
const MODEL_FILTERS = [
|
||||
@@ -605,9 +606,8 @@ function ModelManager({
|
||||
}
|
||||
|
||||
const isTauriDesktop = typeof window !== "undefined" && window.__TAURI_INTERNALS__ !== undefined;
|
||||
const isLocalServerMode = typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1");
|
||||
|
||||
if (!isTauriDesktop && !isLocalServerMode) {
|
||||
if (!isTauriDesktop && !isLocalServerMode()) {
|
||||
showAlert({ title: "Server Required", message: "Model download requires the local server.", danger: true });
|
||||
return;
|
||||
}
|
||||
@@ -959,11 +959,10 @@ function ModelManager({
|
||||
|
||||
const performLoadModel = async (modelId, forcedConstraints = null) => {
|
||||
const isTauriDesktop = typeof window !== "undefined" && window.__TAURI_INTERNALS__ !== undefined;
|
||||
const isLocalServerMode = typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1");
|
||||
const backendStatus = await getBackendStatus();
|
||||
const backendPort = backendStatus?.port || 8080;
|
||||
|
||||
if (!isTauriDesktop && !isLocalServerMode) {
|
||||
if (!isTauriDesktop && !isLocalServerMode()) {
|
||||
const isAlreadyRunning = await pingServer();
|
||||
const modelInfo = getLocalModelInfo(modelId);
|
||||
const isOpenVinoModel = modelInfo?.backendType === "openvino-npu";
|
||||
|
||||
@@ -11,8 +11,9 @@ let cachedSpecs = null;
|
||||
let cachedBackendPort = null;
|
||||
export const EXPECTED_SERVER_BUILD = "text-image-v1";
|
||||
|
||||
const isLocalServerMode = () => {
|
||||
return typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1");
|
||||
export const isLocalServerMode = () => {
|
||||
if (typeof window === "undefined") return false;
|
||||
return window.location.protocol === "http:" || window.location.protocol === "https:";
|
||||
};
|
||||
|
||||
async function getBackendPort() {
|
||||
@@ -31,6 +32,9 @@ async function getBackendPort() {
|
||||
}
|
||||
|
||||
async function getBackendBaseUrl() {
|
||||
if (!isTauri() && isLocalServerMode()) {
|
||||
return "";
|
||||
}
|
||||
return `http://127.0.0.1:${await getBackendPort()}`;
|
||||
}
|
||||
|
||||
@@ -224,8 +228,7 @@ export async function listLocalModels() {
|
||||
}
|
||||
}
|
||||
|
||||
const isLocalServerMode = typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1");
|
||||
if (isLocalServerMode) {
|
||||
if (isLocalServerMode()) {
|
||||
return await listModelsFromDisk();
|
||||
}
|
||||
|
||||
@@ -1162,8 +1165,7 @@ export async function deleteModel(filename) {
|
||||
return await invoke("delete_model_file", { filename });
|
||||
}
|
||||
|
||||
const isLocalServerMode = typeof window !== "undefined" && (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1");
|
||||
if (isLocalServerMode) {
|
||||
if (isLocalServerMode()) {
|
||||
try {
|
||||
const res = await fetch("/api/delete-model", {
|
||||
method: "POST",
|
||||
|
||||
Reference in new issue
Block a user