feat(frontend): improve agent and KB editor ID display and intent prompts UX

Expose copyable resource IDs in edit modals and replace the intent prompt
dropdown with independent toggle buttons so multi-intent selection wraps cleanly.
This commit is contained in:
wizardchen
2026-05-28 20:53:34 +08:00
committed by lyingbug
parent 0e1282c2da
commit 83808cc5b7
6 changed files with 269 additions and 91 deletions
@@ -41,6 +41,20 @@
<p class="section-desc">{{ $t('knowledgeEditor.basic.description') }}</p>
</div>
<div class="section-body">
<div v-if="mode === 'edit' && props.kbId" class="form-item">
<label class="form-label">{{ $t('knowledgeEditor.basic.kbId') }}</label>
<p class="form-tip">{{ $t('knowledgeEditor.basic.kbIdDesc') }}</p>
<div class="kb-id-field">
<code class="kb-id-value" :title="props.kbId">{{ props.kbId }}</code>
<t-tooltip :content="$t('common.copy')" placement="top">
<t-button theme="default" size="small" variant="text" class="kb-id-copy"
@click="copyKbId">
<t-icon name="file-copy" />
</t-button>
</t-tooltip>
</div>
</div>
<div class="form-item">
<label class="form-label required">{{ $t('knowledgeEditor.basic.typeLabel') }}</label>
<t-radio-group
@@ -405,6 +419,30 @@ const emit = defineEmits<{
(e: 'success', kbId: string): void
}>()
const copyKbId = async () => {
const id = props.kbId
if (!id) return
try {
if (navigator.clipboard?.writeText) {
await navigator.clipboard.writeText(id)
} else {
const textarea = document.createElement('textarea')
textarea.value = id
textarea.setAttribute('readonly', '')
textarea.style.position = 'fixed'
textarea.style.opacity = '0'
document.body.appendChild(textarea)
textarea.select()
document.execCommand('copy')
document.body.removeChild(textarea)
}
MessagePlugin.success(t('common.copied'))
} catch {
MessagePlugin.error(t('common.copyFailed'))
}
}
const currentSection = ref<string>('basic')
const saving = ref(false)
const loading = ref(false)
@@ -1498,6 +1536,44 @@ watch(
color: var(--td-text-color-placeholder);
}
.kb-id-field {
display: flex;
align-items: center;
gap: 4px;
width: 100%;
max-width: 480px;
margin-top: 8px;
padding: 6px 8px 6px 12px;
background: var(--td-bg-color-secondarycontainer);
border: 1px solid var(--td-component-stroke);
border-radius: 6px;
.kb-id-value {
flex: 1;
min-width: 0;
margin: 0;
padding: 0;
background: none;
border: none;
font-family: var(--app-font-family-mono);
font-size: 13px;
line-height: 1.5;
color: var(--td-text-color-primary);
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.kb-id-copy {
flex-shrink: 0;
color: var(--td-text-color-secondary);
&:hover {
color: var(--td-brand-color);
}
}
}
.granularity-radio-group {
margin-top: 4px;
}