feat: prepare Zhinian desktop client for pilot release
This commit is contained in:
70
electron/yinian/unconfigured-control-plane.ts
Normal file
70
electron/yinian/unconfigured-control-plane.ts
Normal file
@@ -0,0 +1,70 @@
|
||||
import type {
|
||||
YinianAuthSession,
|
||||
YinianConfigSnapshot,
|
||||
YinianImageCaptcha,
|
||||
YinianLocalSkill,
|
||||
YinianLoginWithPasswordInput,
|
||||
YinianLoginWithSmsInput,
|
||||
YinianServerStatus,
|
||||
YinianSessionState,
|
||||
YinianSkillRegistry,
|
||||
YinianSkillSyncResult,
|
||||
} from '../../shared/yinian';
|
||||
import type { YinianControlPlane } from './control-plane';
|
||||
|
||||
const MESSAGE = '服务端地址未配置,请设置 YINIAN_API_BASE_URL 后重新启动智念助手。';
|
||||
|
||||
export class UnconfiguredYinianControlPlane implements YinianControlPlane {
|
||||
async getServerStatus(): Promise<YinianServerStatus> {
|
||||
return {
|
||||
mode: 'http',
|
||||
reachable: false,
|
||||
checkedAt: Date.now(),
|
||||
message: MESSAGE,
|
||||
};
|
||||
}
|
||||
|
||||
async createImageCaptcha(randomStr = `${Date.now()}`): Promise<YinianImageCaptcha> {
|
||||
return { randomStr, raw: { error: MESSAGE } };
|
||||
}
|
||||
|
||||
async restoreSession(): Promise<YinianSessionState> {
|
||||
return { authenticated: false };
|
||||
}
|
||||
|
||||
async getSessionState(): Promise<YinianSessionState> {
|
||||
return { authenticated: false };
|
||||
}
|
||||
|
||||
async loginWithSms(_input: YinianLoginWithSmsInput): Promise<YinianAuthSession> {
|
||||
throw new Error(MESSAGE);
|
||||
}
|
||||
|
||||
async loginWithPassword(_input: YinianLoginWithPasswordInput): Promise<YinianAuthSession> {
|
||||
throw new Error(MESSAGE);
|
||||
}
|
||||
|
||||
async logout(): Promise<YinianSessionState> {
|
||||
return { authenticated: false };
|
||||
}
|
||||
|
||||
async switchHotel(_hotelId: string): Promise<YinianAuthSession> {
|
||||
throw new Error(MESSAGE);
|
||||
}
|
||||
|
||||
async getConfigSnapshot(): Promise<YinianConfigSnapshot> {
|
||||
throw new Error(MESSAGE);
|
||||
}
|
||||
|
||||
async syncSkills(): Promise<YinianSkillSyncResult> {
|
||||
throw new Error(MESSAGE);
|
||||
}
|
||||
|
||||
async listLocalSkills(): Promise<YinianLocalSkill[]> {
|
||||
return [];
|
||||
}
|
||||
|
||||
async getSkillRegistry(_hotelId?: string): Promise<YinianSkillRegistry | Record<string, YinianSkillRegistry> | undefined> {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user