Secrets manager (#4131)

* Secret manager (now for real)

* Refactor secret manager dialog

* Add error handling to secrets migration

* Adjust default value

* Add secret-id slash command

* Add secret management slash commands

* Improve type definitions

* Improve compatibility of UUID generator

* Add copy buttons to manager view

* Improve compatibility with Vertex AI service account
- Changed to input since textarea can't be used with datalist
- Unblock regular key placeholder
- Save email as a key label
- Interrupt validation if the input is a UUID (autocompleted)

* Add optional label input for secret values in key manager dialog

* Update masking rules

* /secret-id: make the arg "required" (it's not)
This commit is contained in:
Cohee
2025-06-11 21:26:19 +03:00
committed by GitHub
parent 8b5a8914b1
commit 8d2b9d2dab
16 changed files with 1619 additions and 238 deletions
@@ -13,6 +13,7 @@ import { SlashCommandParser } from '../../slash-commands/SlashCommandParser.js';
import { SlashCommandScope } from '../../slash-commands/SlashCommandScope.js';
import { collapseSpaces, getUniqueName, isFalseBoolean, uuidv4 } from '../../utils.js';
import { t } from '../../i18n.js';
import { getSecretLabelById } from '../../secrets.js';
const MODULE_NAME = 'connection-manager';
const NONE = '<None>';
@@ -41,6 +42,7 @@ const CC_COMMANDS = [
'start-reply-with',
'reasoning-template',
'prompt-post-processing',
'secret-id',
];
const TC_COMMANDS = [
@@ -57,6 +59,7 @@ const TC_COMMANDS = [
'stop-strings',
'start-reply-with',
'reasoning-template',
'secret-id',
];
const FANCY_NAMES = {
@@ -75,6 +78,7 @@ const FANCY_NAMES = {
'start-reply-with': 'Start Reply With',
'reasoning-template': 'Reasoning Template',
'prompt-post-processing': 'Prompt Post-Processing',
'secret-id': 'Secret',
};
/**
@@ -344,6 +348,15 @@ function makeFancyProfile(profile) {
return acc;
}
// UUID is not very useful in the UI, so we replace it with a label (if available)
if (key === 'secret-id') {
const label = getSecretLabelById(profile[key]);
if (label) {
acc[value] = label;
return acc;
}
}
acc[value] = profile[key];
return acc;
}, {});