feat: JsonEditor for inputting JSON content (#4)
* feat(editor): add JsonEditor component for JSON configuration editing * fix(provider): update API Key visibility logic in ProviderForm component * fix(editor): stabilize JsonEditor height and restore API Key logic - Revert API Key visibility to preset-based rule and injection to non-custom preset only. - Reduce JsonEditor min-height from rows*22px to rows*18px to lessen layout jitter when switching presets. - Keep fonts/size consistent with the previous textarea for visual parity. * - fix(form): remove websiteUrl auto-extraction from JSON to prevent incorrect overrides --------- Co-authored-by: Jason <farion1231@gmail.com>
This commit is contained in:
@@ -33,21 +33,6 @@ export const checkCoAuthoredSetting = (jsonString: string): boolean => {
|
||||
}
|
||||
};
|
||||
|
||||
// 从JSON配置中提取并处理官网地址
|
||||
export const extractWebsiteUrl = (jsonString: string): string => {
|
||||
try {
|
||||
const config = JSON.parse(jsonString);
|
||||
const baseUrl = config?.env?.ANTHROPIC_BASE_URL;
|
||||
|
||||
if (baseUrl && typeof baseUrl === "string") {
|
||||
// 去掉 "api." 前缀
|
||||
return baseUrl.replace(/^https?:\/\/api\./, "https://");
|
||||
}
|
||||
} catch (err) {
|
||||
// 忽略JSON解析错误
|
||||
}
|
||||
return "";
|
||||
};
|
||||
|
||||
// 读取配置中的 API Key(env.ANTHROPIC_AUTH_TOKEN)
|
||||
export const getApiKeyFromConfig = (jsonString: string): string => {
|
||||
|
||||
Reference in New Issue
Block a user