mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-07-22 21:27:11 +08:00
- 编辑连接前主动拉取可编辑配置,恢复主密码与 SSH 等已保存密钥 - 支持 AI 供应商编辑态回填 API Key,并保持默认遮罩展示 - 修正 AI 设置长错误提示换行展示,避免测试连接报错被裁切 Refs #489
30 lines
591 B
TypeScript
30 lines
591 B
TypeScript
export type ProviderSecretDraftMode = 'replace' | 'clear';
|
|
|
|
export interface ProviderSecretDraftInput {
|
|
apiKeyInput?: string;
|
|
}
|
|
|
|
export interface ProviderSecretDraftResult {
|
|
mode: ProviderSecretDraftMode;
|
|
apiKey: string;
|
|
hasSecret: boolean;
|
|
}
|
|
|
|
export function resolveProviderSecretDraft(input: ProviderSecretDraftInput): ProviderSecretDraftResult {
|
|
const apiKey = String(input.apiKeyInput || '').trim();
|
|
|
|
if (apiKey) {
|
|
return {
|
|
mode: 'replace',
|
|
apiKey,
|
|
hasSecret: true,
|
|
};
|
|
}
|
|
|
|
return {
|
|
mode: 'clear',
|
|
apiKey: '',
|
|
hasSecret: false,
|
|
};
|
|
}
|