Refactor API key handling in AssistantPage and ComponentsModelsPage
- Update AssistantPage to use a stored value mask for API keys, improving security and user experience. - Modify ComponentsModelsPage to display the current API key contextually, enhancing clarity for users. - Adjust related components to ensure consistent handling of API key visibility and management.
This commit is contained in:
@@ -696,6 +696,14 @@ export function ComponentsModelsPage() {
|
||||
>
|
||||
API Key
|
||||
</FieldLabel>
|
||||
{hasStoredApiKey && (
|
||||
<div className="mb-2 flex items-center gap-2 text-xs text-muted-foreground">
|
||||
<span>当前密钥</span>
|
||||
<code className="rounded-md bg-surface-strong px-2 py-1 font-mono text-foreground">
|
||||
{editingModel?.apiKey}
|
||||
</code>
|
||||
</div>
|
||||
)}
|
||||
<div className="relative">
|
||||
<Input
|
||||
id="model-api-key"
|
||||
@@ -722,7 +730,7 @@ export function ComponentsModelsPage() {
|
||||
</div>
|
||||
{hasStoredApiKey && (
|
||||
<p className="mt-2 text-xs leading-5 text-muted-foreground">
|
||||
已有密钥不会返回浏览器。留空可保持原密钥,输入新值将覆盖原密钥。
|
||||
仅显示当前密钥首尾用于识别。留空可保持原密钥,输入新值将覆盖原密钥。
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user