feat: 更新获取配置接口,增加动态获取访问地址功能

This commit is contained in:
2026-02-28 04:33:24 +08:00
parent acd88fb815
commit 73d0fb9730
2 changed files with 28 additions and 5 deletions

View File

@@ -381,13 +381,22 @@ export class AssistantConfig {
protected getDefaultInitAssistantConfig() {
const id = randomId();
const isCNB = !!useKey('CNB');
let kevisualUrl = 'https://kevisual.cn';
if (isCNB) {
const uri = getCNBUrl();
if (uri) {
kevisualUrl = uri;
} else {
kevisualUrl = 'http://kevisual.cn';
}
}
return {
app: {
url: 'https://kevisual.cn',
url: kevisualUrl,
id,
},
description: '助手配置文件',
docs: "https://kevisual.cn/root/cli/docs/",
docs: `${kevisualUrl}/root/cli/docs/`,
home: isCNB ? '/root/cli-center' : '/root/home',
proxy: [],
share: {
@@ -413,4 +422,14 @@ export const parseIfJson = (content: string) => {
export * from './args.ts';
const randomId = () => Math.random().toString(36).substring(2, 8);
const randomId = () => Math.random().toString(36).substring(2, 8);
export const getCNBUrl = () => {
const isCNB = !!useKey('CNB');
const uri = useKey('CNB_VSCODE_PROXY_URI') as string;
if (!isCNB) return null
if (uri) {
return uri.replace('{{port}}', '51515');
}
return null
}