Improve remote endpoint detection

This commit is contained in:
lutc5
2026-04-30 12:57:47 +08:00
parent 2bcb0a6715
commit e88856e1fc
13 changed files with 628 additions and 50 deletions

View File

@@ -9,6 +9,8 @@ export function ClearRequests():Promise<void>;
export function GetConfig():Promise<service.Config>;
export function GetDetectionInfo():Promise<main.DetectionInfo>;
export function GetModels():Promise<Array<main.ModelInfo>>;
export function GetRequests():Promise<Array<main.RequestRecord>>;

View File

@@ -14,6 +14,10 @@ export function GetConfig() {
return window['go']['main']['App']['GetConfig']();
}
export function GetDetectionInfo() {
return window['go']['main']['App']['GetDetectionInfo']();
}
export function GetModels() {
return window['go']['main']['App']['GetModels']();
}

View File

@@ -1,5 +1,47 @@
export namespace main {
export class DetectionInfo {
listenUrl: string;
backend: string;
backendLabel: string;
ipcSuccess: boolean;
ipcTransport?: string;
ipcEndpoint?: string;
ipcError?: string;
remoteBaseUrl: string;
remoteBaseUrlSource?: string;
remoteCredentialSuccess: boolean;
remoteCredentialSource?: string;
remoteUserId?: string;
remoteMachineId?: string;
remoteTokenExpireAt?: string;
remoteTokenExpired: boolean;
remoteCredentialError?: string;
static createFrom(source: any = {}) {
return new DetectionInfo(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.listenUrl = source["listenUrl"];
this.backend = source["backend"];
this.backendLabel = source["backendLabel"];
this.ipcSuccess = source["ipcSuccess"];
this.ipcTransport = source["ipcTransport"];
this.ipcEndpoint = source["ipcEndpoint"];
this.ipcError = source["ipcError"];
this.remoteBaseUrl = source["remoteBaseUrl"];
this.remoteBaseUrlSource = source["remoteBaseUrlSource"];
this.remoteCredentialSuccess = source["remoteCredentialSuccess"];
this.remoteCredentialSource = source["remoteCredentialSource"];
this.remoteUserId = source["remoteUserId"];
this.remoteMachineId = source["remoteMachineId"];
this.remoteTokenExpireAt = source["remoteTokenExpireAt"];
this.remoteTokenExpired = source["remoteTokenExpired"];
this.remoteCredentialError = source["remoteCredentialError"];
}
}
export class ModelInfo {
id: string;
name: string;
@@ -17,6 +59,7 @@ export namespace main {
export class ProxyStatus {
running: boolean;
addr: string;
backend: string;
models: number;
model?: string;
startedAt?: string;
@@ -29,6 +72,7 @@ export namespace main {
if ('string' === typeof source) source = JSON.parse(source);
this.running = source["running"];
this.addr = source["addr"];
this.backend = source["backend"];
this.models = source["models"];
this.model = source["model"];
this.startedAt = source["startedAt"];