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:
Xin Wang
2026-06-09 12:53:03 +08:00
parent 044411edc6
commit a8b6c09920
2 changed files with 28 additions and 10 deletions

View File

@@ -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>