@tano.page/workbench 0.14.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +21 -8
- package/src/App.vue +76 -17
- package/src/appearance/appearance.ts +14 -4
- package/src/appearance/components/ThemePresetPreview.vue +52 -8
- package/src/appearance/interface-font.ts +99 -0
- package/src/appearance/theme.ts +26 -10
- package/src/appearance/use-interface-font.ts +30 -0
- package/src/assets/mail-provider-icons/NOTICE.txt +27 -0
- package/src/assets/mail-provider-icons/aliyun-mail.svg +3 -0
- package/src/assets/mail-provider-icons/gmail.svg +1 -0
- package/src/assets/mail-provider-icons/icloud.svg +12 -0
- package/src/assets/mail-provider-icons/netease-126.svg +5 -0
- package/src/assets/mail-provider-icons/netease-163.svg +5 -0
- package/src/assets/mail-provider-icons/qq.svg +9 -0
- package/src/assets/mail-provider-icons/tencent-exmail.svg +4 -0
- package/src/assistant/components/AssistantChangeList.vue +98 -21
- package/src/assistant/components/AssistantPanel.vue +424 -7
- package/src/assistant/components/PluginToolProposalCard.vue +235 -0
- package/src/assistant/engine.ts +56 -3
- package/src/assistant/files.ts +5 -13
- package/src/assistant/inbox.ts +1 -148
- package/src/assistant/locales/de-DE.json +4 -1
- package/src/assistant/locales/en-US.json +4 -1
- package/src/assistant/locales/es-ES.json +4 -1
- package/src/assistant/locales/ja-JP.json +4 -1
- package/src/assistant/locales/zh-CN.json +4 -1
- package/src/assistant/locales/zh-TW.json +4 -1
- package/src/assistant/mention-autocomplete.ts +69 -0
- package/src/assistant/prompts.ts +7 -0
- package/src/assistant/results.ts +20 -86
- package/src/assistant/store.ts +319 -12
- package/src/assistant/structures.ts +7 -5
- package/src/assistant/tasks.ts +3 -5
- package/src/assistant/workspace-bridge.ts +1 -1
- package/src/composables/use-document-actions.ts +38 -20
- package/src/composables/use-file-tree-controller.ts +7 -12
- package/src/composables/use-workbench-history.ts +2 -4
- package/src/composables/use-workbench-modals.ts +6 -1
- package/src/composables/use-workbench-outline.ts +0 -5
- package/src/composables/use-workbench-shortcuts.ts +26 -22
- package/src/data-tables/data-tables.ts +1 -2
- package/src/documents/components/DocumentHistoryPanel.vue +3 -1
- package/src/features.ts +1 -0
- package/src/fonts/Inter-Latin-Italic.woff2 +0 -0
- package/src/fonts/Inter-Latin.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Bold.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Medium.woff2 +0 -0
- package/src/fonts/TanoUISansSC-Regular.woff2 +0 -0
- package/src/help/help-milestones.ts +3 -5
- package/src/i18n/locales/de-DE.json +349 -3
- package/src/i18n/locales/en-US.json +349 -2
- package/src/i18n/locales/es-ES.json +349 -3
- package/src/i18n/locales/ja-JP.json +348 -2
- package/src/i18n/locales/zh-TW.json +348 -2
- package/src/mail/components/MailAccountDialog.vue +449 -0
- package/src/mail/components/MailComposerDialog.vue +325 -0
- package/src/mail/components/MailProviderIcon.vue +30 -0
- package/src/mail/components/MailWorkspaceView.vue +820 -0
- package/src/mail/components/SidebarMail.vue +133 -0
- package/src/mail/mail-avatar.ts +17 -0
- package/src/mail/mail-bridge.ts +68 -0
- package/src/mail/mail-calendar.ts +208 -0
- package/src/mail/mail-markdown.ts +195 -0
- package/src/mail/types.ts +226 -0
- package/src/objects/components/ObjectDetailModal.vue +1001 -0
- package/src/objects/workspace-objects.ts +1 -1
- package/src/plan-sync/types.ts +6 -3
- package/src/plans/calendar-interaction.ts +194 -0
- package/src/plans/calendar.ts +63 -7
- package/src/plans/components/CalendarDayPopover.vue +172 -39
- package/src/plans/components/CalendarView.vue +1736 -276
- package/src/plans/components/PlanArchiveDialog.vue +295 -0
- package/src/plans/components/PlanDateField.vue +6 -4
- package/src/plans/components/PlanDetailPanel.vue +227 -32
- package/src/plans/components/PlanEventList.vue +16 -4
- package/src/plans/components/SidebarPlan.vue +22 -15
- package/src/plans/components/TaskRepeatControls.vue +169 -30
- package/src/plans/local-reminders.ts +149 -0
- package/src/plans/personal-plans.ts +10 -1
- package/src/plans/plan-date.ts +8 -1
- package/src/plans/plan-migration.ts +95 -0
- package/src/plans/recurrence.ts +95 -0
- package/src/plans/task-repeat.ts +8 -8
- package/src/plans/timeline-layout.ts +92 -0
- package/src/plugins/assistant-bridge.ts +520 -0
- package/src/plugins/attachment-reader.ts +3 -1
- package/src/plugins/cache-storage.ts +42 -2
- package/src/plugins/components/PluginAutomations.vue +3 -3
- package/src/plugins/components/PluginCatalogBrowser.vue +17 -8
- package/src/plugins/components/PluginChangeSummary.vue +16 -3
- package/src/plugins/components/PluginConnections.vue +1 -1
- package/src/plugins/components/PluginCustomView.vue +2 -2
- package/src/plugins/components/PluginDetailPage.vue +129 -54
- package/src/plugins/components/PluginDocumentSlot.vue +63 -0
- package/src/plugins/components/PluginExplorer.vue +15 -21
- package/src/plugins/components/PluginImportDialog.vue +410 -0
- package/src/plugins/components/PluginInstaller.vue +39 -145
- package/src/plugins/components/PluginListItem.vue +3 -0
- package/src/plugins/components/PluginMaintenance.vue +21 -6
- package/src/plugins/components/PluginRuntimePanel.vue +3 -3
- package/src/plugins/components/PluginSettingsForm.vue +111 -0
- package/src/plugins/components/PluginStatusBar.vue +161 -0
- package/src/plugins/components/PluginSurface.vue +18 -6
- package/src/plugins/components/PluginUiDialog.vue +452 -0
- package/src/plugins/excalidraw/bundle.tano-plugin.json +1 -1
- package/src/plugins/excalidraw/manifest.json +12 -1
- package/src/plugins/host.ts +662 -43
- package/src/plugins/native.ts +2 -10
- package/src/plugins/overlay-mapping.ts +125 -0
- package/src/plugins/packages.ts +73 -1
- package/src/plugins/plugin-permissions.ts +57 -0
- package/src/plugins/plugin-sdk.ts +174 -8
- package/src/plugins/policy.ts +53 -3
- package/src/plugins/presentation-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/presentation-preview/manifest.json +2 -1
- package/src/plugins/queries.ts +3 -1
- package/src/plugins/sandbox.ts +15 -1
- package/src/plugins/use-plugin-actions.ts +67 -20
- package/src/plugins/user-plugins.ts +254 -0
- package/src/plugins/word-preview/bundle.tano-plugin.json +1 -1
- package/src/plugins/word-preview/manifest.json +13 -1
- package/src/plugins/workbench.ts +175 -2
- package/src/plugins/worker.js +105 -8
- package/src/plugins/workspace-plugin-runtime.ts +23 -7
- package/src/plugins/workspace-plugins.ts +212 -21
- package/src/runtime.ts +101 -3
- package/src/settings/components/SettingsAppearancePage.vue +46 -0
- package/src/settings/components/SettingsDocumentsPage.vue +0 -1
- package/src/settings/components/settings-search.ts +2 -3
- package/src/shell/components/SidebarNavigation.vue +22 -2
- package/src/shell/components/WorkbenchContextMenus.vue +21 -8
- package/src/shell/components/WorkbenchModals.vue +27 -46
- package/src/shell/components/WorkbenchPanes.vue +267 -84
- package/src/shell/components/WorkspaceBreadcrumb.vue +6 -14
- package/src/shell/components/WorkspaceViewSwitcher.vue +12 -7
- package/src/shell/use-workbench.ts +116 -145
- package/src/shell/workbench-async-components.ts +14 -5
- package/src/stores/mail.ts +414 -0
- package/src/stores/plan-sync.ts +2 -1
- package/src/stores/plans.ts +2 -9
- package/src/stores/workspace-knowledge.ts +1 -113
- package/src/stores/workspace-plugins-state.ts +537 -14
- package/src/stores/workspace-tabs-layout.ts +5 -43
- package/src/stores/workspace.ts +69 -66
- package/src/styles/agent-diff-modals.css +0 -7
- package/src/styles/dark-theme.css +3 -3
- package/src/styles/inspector.css +0 -59
- package/src/styles/layout-themes.css +346 -0
- package/src/styles/mail.css +1568 -0
- package/src/styles/mobile.css +2 -2
- package/src/styles/recent-and-media.css +0 -17
- package/src/styles/theme-contract.css +3 -3
- package/src/styles/workbench-shell.css +110 -17
- package/src/styles/workspace-states.css +9 -33
- package/src/styles.css +1 -1
- package/src/tabs/components/DesktopTabs.vue +0 -3
- package/src/tabs/components/NewTabPicker.vue +10 -4
- package/src/tabs/tab-label.ts +0 -1
- package/src/workspace/components/WorkspaceGeneralSettings.vue +0 -13
- package/src/workspace/components/WorkspaceIconPicker.vue +28 -6
- package/src/workspace/workspace-comments.ts +11 -151
- package/src/workspace/workspace-welcome.ts +1 -1
- package/src/documents/components/FormulaMenu.vue +0 -50
- package/src/files/components/FileDatabasePage.vue +0 -152
- package/src/files/components/FolderHomeIcon.vue +0 -12
- package/src/objects/components/ObjectDatabasePage.vue +0 -100
- package/src/objects/components/ObjectPanel.vue +0 -554
- package/src/plans/components/PersonalPlanDialog.vue +0 -105
- package/src/shell/components/WorkspaceViewPage.vue +0 -127
- package/src/shell/components/WorkspaceViewTab.vue +0 -24
- package/src/styles/object-panel.css +0 -163
- package/src/workspace/components/GitInspectionPanel.vue +0 -35
- package/src/workspace/components/WorkspaceSyncPanel.vue +0 -50
- package/src/workspace/welcome-slogans.ts +0 -11
- package/src/workspace/workspace-git.ts +0 -35
- package/src/workspace/workspace-sync.ts +0 -46
- package/src/workspace/workspace-views.ts +0 -48
|
@@ -11,7 +11,7 @@ import { t, uiLocale } from '../../i18n/i18n';
|
|
|
11
11
|
import { assistantCopy, assistantTaskPrompts } from '../language';
|
|
12
12
|
import { computed, inject, nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
|
13
13
|
import { agentInboxKey, type useAgentInboxController } from '../agent-controller';
|
|
14
|
-
import { AlignLeft, ArrowDown, ArrowLeft, ArrowUp, Bot, Check, ChevronDown, ChevronRight, ChevronsRight, CircleCheck, Copy, Cpu, createLucideIcon, FilePlus2, FileText, History, Image as ImageIcon, Languages, LoaderCircle, MessageCircle, MessageCirclePlus, Minus, MoreHorizontal, Paperclip, Pencil, Plug, Plus, RefreshCw, Reply, Quote, Search, Settings2, Square, Trash2, Undo2, X } from 'lucide-vue-next';
|
|
14
|
+
import { AlignLeft, ArrowDown, ArrowLeft, ArrowUp, Bot, Check, ChevronDown, ChevronRight, ChevronsRight, CircleCheck, Copy, Cpu, createLucideIcon, FilePlus2, FileText, History, Image as ImageIcon, Languages, LoaderCircle, MessageCircle, MessageCirclePlus, Minus, MoreHorizontal, Paperclip, Pencil, Plug, Plus, RefreshCw, Reply, Quote, Search, Settings2, ShieldAlert, Sparkles, Square, Trash2, Undo2, X } from 'lucide-vue-next';
|
|
15
15
|
import MarkdownEditor from '@tano/editor';
|
|
16
16
|
import { confirmEntryReferenceDrop, droppedEntryReferences, entryReferenceDragType, referenceMarkdown } from '@tano/protocol';
|
|
17
17
|
import type { AssistantMessage, AssistantProposal, AssistantReasoningSelection, AssistantSource, ReferenceIdentity } from '@tano/protocol';
|
|
@@ -21,6 +21,15 @@ import { clipboardAssistantFiles } from '../attachments';
|
|
|
21
21
|
import { assistantToolLabel, assistantAnswerText } from '../results';
|
|
22
22
|
import type { AssistantDisplayMode } from '../store';
|
|
23
23
|
import { useWorkspaceStore } from '../../stores/workspace';
|
|
24
|
+
import { resolveAssistantExtension, useWorkbenchRuntime, type WorkbenchAssistantStarter } from '../../runtime';
|
|
25
|
+
import { summarizePluginAssistantCapabilities, type ActivePluginContextProvider } from '../../plugins/assistant-bridge';
|
|
26
|
+
import {
|
|
27
|
+
applyMentionSelection,
|
|
28
|
+
detectMentionTrigger,
|
|
29
|
+
filterPluginContextProviders,
|
|
30
|
+
formatPluginMentionToken,
|
|
31
|
+
type MentionTrigger,
|
|
32
|
+
} from '../mention-autocomplete';
|
|
24
33
|
import AssistantChangeList from './AssistantChangeList.vue';
|
|
25
34
|
import AssistantConnectionAvatar from './AssistantConnectionAvatar.vue';
|
|
26
35
|
import AssistantModelIcon from './AssistantModelIcon.vue';
|
|
@@ -34,6 +43,8 @@ import type { ShortcutBinding } from '../../shell/shortcuts';
|
|
|
34
43
|
|
|
35
44
|
const assistant = useAssistantStore();
|
|
36
45
|
const workspace = useWorkspaceStore();
|
|
46
|
+
const runtime = useWorkbenchRuntime();
|
|
47
|
+
const assistantExtension = computed(() => resolveAssistantExtension(runtime));
|
|
37
48
|
const props = defineProps<{ compact?: boolean; fullscreenTarget?: string | HTMLElement; navigationVisible?: boolean; toggleShortcut?: ShortcutBinding }>();
|
|
38
49
|
const emit = defineEmits<{ openReference: [identity: ReferenceIdentity]; revealSelection: [source: AssistantSource]; openSettings: []; closed: []; showNavigation: [] }>();
|
|
39
50
|
function afterPanelLeave() {
|
|
@@ -64,7 +75,11 @@ function cancelModeAnimation() {
|
|
|
64
75
|
modeAnimation?.cancel();
|
|
65
76
|
modeAnimation = undefined;
|
|
66
77
|
}
|
|
67
|
-
const popover = ref<'model' | 'reasoning' | 'add' | 'history' | 'more' | 'mode' | null>(null);
|
|
78
|
+
const popover = ref<'model' | 'reasoning' | 'add' | 'capabilities' | 'history' | 'more' | 'mode' | null>(null);
|
|
79
|
+
const mentionTrigger = ref<MentionTrigger | null>(null);
|
|
80
|
+
const mentionDismissedAt = ref<number | null>(null);
|
|
81
|
+
const mentionActiveIndex = ref(0);
|
|
82
|
+
const isComposing = ref(false);
|
|
68
83
|
function displayIcon(name: string, region: { x: string; y: string; width: string; height: string }) {
|
|
69
84
|
return createLucideIcon(name, [
|
|
70
85
|
['rect', { x: '2', y: '4', width: '20', height: '16', rx: '2', key: 'frame' }],
|
|
@@ -133,6 +148,69 @@ const starters = computed(() => {
|
|
|
133
148
|
{ label: copy.tasks, prompt: prompts.tasks, icon: CircleCheck },
|
|
134
149
|
];
|
|
135
150
|
});
|
|
151
|
+
const extensionStarters = computed(() =>
|
|
152
|
+
assistantExtension.value?.starters?.({ demo: assistant.demo }) ?? [],
|
|
153
|
+
);
|
|
154
|
+
const pluginCapabilities = computed(() =>
|
|
155
|
+
summarizePluginAssistantCapabilities(
|
|
156
|
+
workspace.installedPlugins,
|
|
157
|
+
workspace.pluginRuntime,
|
|
158
|
+
!!workspace.workspace?.readOnly,
|
|
159
|
+
),
|
|
160
|
+
);
|
|
161
|
+
const safeMode = computed(() => !!workspace.overlaySnapshot?.safeMode);
|
|
162
|
+
const workspaceReadOnly = computed(() => !!workspace.workspace?.readOnly);
|
|
163
|
+
const personalCodePolicy = computed(() => workspace.personalCodePluginPolicy);
|
|
164
|
+
const extensionCapabilityNotes = computed(() =>
|
|
165
|
+
assistantExtension.value?.capabilitySummary?.({
|
|
166
|
+
workspaceReadOnly: workspaceReadOnly.value,
|
|
167
|
+
safeMode: safeMode.value,
|
|
168
|
+
}) ?? [],
|
|
169
|
+
);
|
|
170
|
+
const activePluginToolCount = computed(
|
|
171
|
+
() => pluginCapabilities.value.tools.filter(item => item.available).length,
|
|
172
|
+
);
|
|
173
|
+
const hasCapabilityRestriction = computed(
|
|
174
|
+
() =>
|
|
175
|
+
safeMode.value ||
|
|
176
|
+
workspaceReadOnly.value ||
|
|
177
|
+
personalCodePolicy.value !== 'allow' ||
|
|
178
|
+
extensionCapabilityNotes.value.some(note => note.tone === 'warning'),
|
|
179
|
+
);
|
|
180
|
+
const showCapabilityPill = computed(
|
|
181
|
+
() =>
|
|
182
|
+
pluginCapabilities.value.tools.length > 0 ||
|
|
183
|
+
pluginCapabilities.value.contexts.length > 0 ||
|
|
184
|
+
extensionCapabilityNotes.value.length > 0 ||
|
|
185
|
+
safeMode.value ||
|
|
186
|
+
personalCodePolicy.value !== 'allow',
|
|
187
|
+
);
|
|
188
|
+
const capabilityPillLabel = computed(() => {
|
|
189
|
+
if (safeMode.value) return t('安全模式');
|
|
190
|
+
if (personalCodePolicy.value === 'block') return t('个人插件已屏蔽');
|
|
191
|
+
if (personalCodePolicy.value === 'read-only') return t('团队只读策略');
|
|
192
|
+
if (workspaceReadOnly.value && pluginCapabilities.value.tools.some(item => !item.available)) {
|
|
193
|
+
return t('工作区只读');
|
|
194
|
+
}
|
|
195
|
+
const tools = activePluginToolCount.value;
|
|
196
|
+
const contexts = pluginCapabilities.value.contexts.length;
|
|
197
|
+
if (tools > 0 && contexts > 0) return t('{0} 工具 · {1} 上下文', [tools, contexts]);
|
|
198
|
+
if (tools > 0) return t('{0} 个插件工具', [tools]);
|
|
199
|
+
if (contexts > 0) return t('{0} 个 @上下文', [contexts]);
|
|
200
|
+
return t('扩展能力');
|
|
201
|
+
});
|
|
202
|
+
const mentionProviders = computed(() =>
|
|
203
|
+
mentionTrigger.value
|
|
204
|
+
? filterPluginContextProviders(workspace.pluginContextProviders, mentionTrigger.value.query)
|
|
205
|
+
: [],
|
|
206
|
+
);
|
|
207
|
+
const mentionMenuOpen = computed(
|
|
208
|
+
() =>
|
|
209
|
+
!!mentionTrigger.value &&
|
|
210
|
+
workspace.pluginContextProviders.length > 0 &&
|
|
211
|
+
!controlsLocked.value &&
|
|
212
|
+
!assistant.pendingUserInput,
|
|
213
|
+
);
|
|
136
214
|
const sourceFiles = computed(() => workspace.workspace?.files.filter(file => file.kind === 'file' && isAssistantFile(file.path) &&
|
|
137
215
|
file.path.toLocaleLowerCase().includes(query.value.toLocaleLowerCase())).slice(0, 100) ?? []);
|
|
138
216
|
const displayed = computed(() => assistant.session?.messages.slice(-visibleMessages.value) ?? []);
|
|
@@ -284,7 +362,88 @@ async function exportAnswer() {
|
|
|
284
362
|
message.proposals ??= []; message.proposals.push(proposal); exportMessage.value = undefined;
|
|
285
363
|
await assistant.review(proposal);
|
|
286
364
|
}
|
|
365
|
+
function refreshMentionTrigger() {
|
|
366
|
+
if (isComposing.value || !textarea.value || !workspace.pluginContextProviders.length) {
|
|
367
|
+
mentionTrigger.value = null;
|
|
368
|
+
return;
|
|
369
|
+
}
|
|
370
|
+
const caret = textarea.value.selectionStart ?? assistant.prompt.length;
|
|
371
|
+
const detected = detectMentionTrigger(assistant.prompt, caret);
|
|
372
|
+
if (!detected) {
|
|
373
|
+
mentionTrigger.value = null;
|
|
374
|
+
mentionDismissedAt.value = null;
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
if (mentionDismissedAt.value === detected.start) {
|
|
378
|
+
mentionTrigger.value = null;
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
mentionDismissedAt.value = null;
|
|
382
|
+
mentionTrigger.value = detected;
|
|
383
|
+
if (mentionActiveIndex.value >= mentionProviders.value.length) {
|
|
384
|
+
mentionActiveIndex.value = 0;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function dismissMentionMenu() {
|
|
388
|
+
if (mentionTrigger.value) {
|
|
389
|
+
mentionDismissedAt.value = mentionTrigger.value.start;
|
|
390
|
+
mentionTrigger.value = null;
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
function selectMention(entry: ActivePluginContextProvider) {
|
|
394
|
+
const trigger = mentionTrigger.value;
|
|
395
|
+
if (!trigger) return;
|
|
396
|
+
const applied = applyMentionSelection(
|
|
397
|
+
assistant.prompt,
|
|
398
|
+
trigger,
|
|
399
|
+
entry,
|
|
400
|
+
workspace.pluginContextProviders,
|
|
401
|
+
);
|
|
402
|
+
assistant.prompt = applied.text;
|
|
403
|
+
if (!assistant.pluginContextKeys.includes(entry.key) && assistant.pluginContextKeys.length < 4) {
|
|
404
|
+
assistant.togglePluginContext(entry.key);
|
|
405
|
+
}
|
|
406
|
+
mentionTrigger.value = null;
|
|
407
|
+
mentionDismissedAt.value = null;
|
|
408
|
+
mentionActiveIndex.value = 0;
|
|
409
|
+
void nextTick(() => {
|
|
410
|
+
textarea.value?.focus({ preventScroll: true });
|
|
411
|
+
textarea.value?.setSelectionRange(applied.caret, applied.caret);
|
|
412
|
+
});
|
|
413
|
+
}
|
|
414
|
+
function onComposerInput() {
|
|
415
|
+
refreshMentionTrigger();
|
|
416
|
+
}
|
|
417
|
+
function onComposerKeyup(event: KeyboardEvent) {
|
|
418
|
+
if (['ArrowDown', 'ArrowUp', 'Enter', 'Tab', 'Escape'].includes(event.key)) return;
|
|
419
|
+
refreshMentionTrigger();
|
|
420
|
+
}
|
|
287
421
|
function sendKey(event: KeyboardEvent) {
|
|
422
|
+
if (mentionMenuOpen.value) {
|
|
423
|
+
if (event.key === 'ArrowDown' && mentionProviders.value.length) {
|
|
424
|
+
event.preventDefault();
|
|
425
|
+
mentionActiveIndex.value = (mentionActiveIndex.value + 1) % mentionProviders.value.length;
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
if (event.key === 'ArrowUp' && mentionProviders.value.length) {
|
|
429
|
+
event.preventDefault();
|
|
430
|
+
mentionActiveIndex.value =
|
|
431
|
+
(mentionActiveIndex.value - 1 + mentionProviders.value.length) % mentionProviders.value.length;
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
if ((event.key === 'Enter' || event.key === 'Tab') && !event.shiftKey && !event.isComposing && mentionProviders.value.length) {
|
|
435
|
+
event.preventDefault();
|
|
436
|
+
const target = mentionProviders.value[mentionActiveIndex.value] ?? mentionProviders.value[0];
|
|
437
|
+
if (target) selectMention(target);
|
|
438
|
+
return;
|
|
439
|
+
}
|
|
440
|
+
if (event.key === 'Escape') {
|
|
441
|
+
event.preventDefault();
|
|
442
|
+
event.stopPropagation();
|
|
443
|
+
dismissMentionMenu();
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
}
|
|
288
447
|
if (event.key === 'Enter' && !event.shiftKey && !event.isComposing) { event.preventDefault(); void assistant.send(); }
|
|
289
448
|
}
|
|
290
449
|
function togglePopover(kind: NonNullable<typeof popover.value>, event: MouseEvent) {
|
|
@@ -336,6 +495,9 @@ function endFloatingGesture() {
|
|
|
336
495
|
function outsidePopover(event: PointerEvent) {
|
|
337
496
|
if (!(isElement(event.target)) || !panel.value?.contains(event.target) ||
|
|
338
497
|
!event.target.closest('.assistant-popover, [data-assistant-popover]')) closePopover();
|
|
498
|
+
if (!(isElement(event.target)) || !event.target.closest('.assistant-mention-menu, .assistant-composer textarea')) {
|
|
499
|
+
mentionTrigger.value = null;
|
|
500
|
+
}
|
|
339
501
|
}
|
|
340
502
|
function openHistory() {
|
|
341
503
|
closePopover(); section.value = 'history';
|
|
@@ -390,6 +552,39 @@ function preparePrompt(prompt: string) {
|
|
|
390
552
|
assistant.setBuiltInPrompt(prompt);
|
|
391
553
|
void nextTick(() => textarea.value?.focus());
|
|
392
554
|
}
|
|
555
|
+
function prepareExtensionPrompt(starter: WorkbenchAssistantStarter) {
|
|
556
|
+
closePopover();
|
|
557
|
+
if (starter.requiresActiveDocument) {
|
|
558
|
+
const fileId = workspace.active?.id;
|
|
559
|
+
if (fileId && !assistant.files.includes(fileId)) {
|
|
560
|
+
if (assistant.files.length >= 20) { notice.value = t('一次最多选择 20 篇文档,请先移除一篇参考文档'); return; }
|
|
561
|
+
assistant.files.push(fileId);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
assistant.setBuiltInPrompt(starter.prompt);
|
|
565
|
+
void nextTick(() => textarea.value?.focus());
|
|
566
|
+
}
|
|
567
|
+
async function handleProposalFollowUp(payload: { prompt: string; autoSend?: boolean }) {
|
|
568
|
+
if (!payload.prompt.trim()) return;
|
|
569
|
+
closePopover();
|
|
570
|
+
assistant.prompt = payload.prompt;
|
|
571
|
+
await nextTick();
|
|
572
|
+
if (payload.autoSend && !controlsLocked.value && assistant.connection && assistant.modelId) {
|
|
573
|
+
await assistant.send();
|
|
574
|
+
} else {
|
|
575
|
+
textarea.value?.focus();
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
function exitSafeMode() {
|
|
579
|
+
workspace.setSafeMode(false);
|
|
580
|
+
notice.value = t('已退出安全模式');
|
|
581
|
+
closePopover();
|
|
582
|
+
}
|
|
583
|
+
function blockedToolReasonLabel(reason?: 'workspace-read-only' | 'team-read-only' | 'team-blocked') {
|
|
584
|
+
if (reason === 'team-blocked') return t('团队策略已屏蔽个人代码插件');
|
|
585
|
+
if (reason === 'team-read-only') return t('团队只读策略限制写入');
|
|
586
|
+
return t('当前工作区为只读');
|
|
587
|
+
}
|
|
393
588
|
function resizeInput() {
|
|
394
589
|
if (!textarea.value) return;
|
|
395
590
|
// Let each display mode's CSS minimum size the empty composer.
|
|
@@ -398,7 +593,7 @@ function resizeInput() {
|
|
|
398
593
|
updateMenuPosition();
|
|
399
594
|
}
|
|
400
595
|
function updateMenuPosition() {
|
|
401
|
-
if (!['model', 'reasoning', 'add'].includes(popover.value ?? '') || !popoverTrigger) return;
|
|
596
|
+
if (!['model', 'reasoning', 'add', 'capabilities'].includes(popover.value ?? '') || !popoverTrigger) return;
|
|
402
597
|
const element = panel.value;
|
|
403
598
|
const composer = element?.querySelector('.assistant-composer-area');
|
|
404
599
|
const menu = composer?.querySelector('.assistant-popover');
|
|
@@ -462,7 +657,13 @@ onBeforeUnmount(() => {
|
|
|
462
657
|
window.removeEventListener('pointerdown', outsidePopover);
|
|
463
658
|
window.removeEventListener('resize', viewportResized);
|
|
464
659
|
});
|
|
465
|
-
watch(() => assistant.prompt,
|
|
660
|
+
watch(() => assistant.prompt, value => {
|
|
661
|
+
if (!value) {
|
|
662
|
+
mentionTrigger.value = null;
|
|
663
|
+
mentionDismissedAt.value = null;
|
|
664
|
+
}
|
|
665
|
+
void nextTick(resizeInput);
|
|
666
|
+
});
|
|
466
667
|
watch(() => assistant.pendingUserInput?.request.id, (id, previous) => {
|
|
467
668
|
if (id) closePopover();
|
|
468
669
|
void nextTick(() => { scrollToLatest(); resizeInput(); if (!id && previous) textarea.value?.focus({ preventScroll: true }); });
|
|
@@ -597,6 +798,19 @@ watch(() => [assistant.session?.messages.map(message => `${message.content.lengt
|
|
|
597
798
|
<div class="assistant-starters">
|
|
598
799
|
<button v-for="starter in starters" :key="starter.label" class="assistant-starter" :disabled="controlsLocked || !workspace.active" @click="preparePrompt(starter.prompt)"><component :is="starter.icon" :size="18" /><span>{{ starter.label }}</span></button>
|
|
599
800
|
</div>
|
|
801
|
+
<div v-if="extensionStarters.length" class="assistant-extension-starters" :aria-label="t('工作台与插件快捷入口')">
|
|
802
|
+
<button
|
|
803
|
+
v-for="starter in extensionStarters"
|
|
804
|
+
:key="starter.id"
|
|
805
|
+
type="button"
|
|
806
|
+
class="assistant-extension-starter"
|
|
807
|
+
:disabled="controlsLocked || (starter.requiresActiveDocument && !workspace.active)"
|
|
808
|
+
@click="prepareExtensionPrompt(starter)"
|
|
809
|
+
>
|
|
810
|
+
<component :is="starter.icon ?? Sparkles" :size="16" />
|
|
811
|
+
<span>{{ starter.label }}</span>
|
|
812
|
+
</button>
|
|
813
|
+
</div>
|
|
600
814
|
</div>
|
|
601
815
|
<button v-if="(assistant.session?.messages.length ?? 0) > visibleMessages" class="assistant-text-action" @click="visibleMessages += 30">{{ t('查看较早消息') }}</button>
|
|
602
816
|
<div v-if="displayed.length" class="assistant-conversation-meta">{{ t('同页助手 ·') }} {{ messageTime(displayed[0]!.createdAt) }}</div>
|
|
@@ -631,7 +845,7 @@ watch(() => [assistant.session?.messages.map(message => `${message.content.lengt
|
|
|
631
845
|
<small v-if="message.rules?.length" class="assistant-rules">{{ t('工作区约定:') }}{{ message.rules.join('、') }}</small>
|
|
632
846
|
<AssistantChangeList v-if="message.proposals?.length" :proposals="message.proposals" :busy="assistant.busy || assistant.applying"
|
|
633
847
|
@review="assistant.review" @reject="assistant.reject" @verify="assistant.verify" @undo="assistant.undo"
|
|
634
|
-
@suggestions="assistant.publishSuggestions" @open-reference="openAnswerReference" />
|
|
848
|
+
@suggestions="assistant.publishSuggestions" @open-reference="openAnswerReference" @send-follow-up="handleProposalFollowUp" />
|
|
635
849
|
<div v-if="message.role === 'assistant' && !['running', 'waiting'].includes(message.state ?? '')" class="assistant-message-actions">
|
|
636
850
|
<button class="icon-button" :data-tooltip="t('复制回答')" :aria-label="t('复制助手回答')" :disabled="!assistantAnswerText(message).trim()" @click="copy(message)"><Copy :size="14" /></button>
|
|
637
851
|
<button v-if="assistant.replyTarget" class="icon-button" :data-tooltip="t('填写回复草稿:{0}', [assistant.replyTarget.label])" :aria-label="t('将助手回答填入回复草稿')" :disabled="assistant.busy || assistant.applying || !assistantAnswerText(message).trim()" @click="draftReply(message)"><Reply :size="14" /></button>
|
|
@@ -716,6 +930,24 @@ watch(() => [assistant.session?.messages.map(message => `${message.content.lengt
|
|
|
716
930
|
<template v-if="addView === 'main'">
|
|
717
931
|
<button class="assistant-menu-item" data-menu-item :disabled="controlsLocked" @click="openSources"><Paperclip :size="18" /><span class="assistant-menu-label">{{ t('添加参考文档') }}</span><ChevronRight :size="15" /></button>
|
|
718
932
|
<button class="assistant-menu-item" data-menu-item :disabled="controlsLocked || !workspace.active" @click="addCurrentNote"><FileText :size="18" /><span class="assistant-menu-label">{{ t('引用当前笔记') }}</span><Check v-if="workspace.active && assistant.files.includes(workspace.active.id)" :size="16" class="assistant-menu-check" /></button>
|
|
933
|
+
<template v-if="workspace.pluginContextProviders.length">
|
|
934
|
+
<div class="assistant-menu-divider" />
|
|
935
|
+
<button
|
|
936
|
+
v-for="entry in workspace.pluginContextProviders"
|
|
937
|
+
:key="entry.key"
|
|
938
|
+
class="assistant-menu-item"
|
|
939
|
+
:class="{ selected: assistant.pluginContextKeys.includes(entry.key) }"
|
|
940
|
+
:aria-pressed="assistant.pluginContextKeys.includes(entry.key)"
|
|
941
|
+
:data-tooltip="`${entry.pluginName} · ${entry.provider.description}`"
|
|
942
|
+
:disabled="controlsLocked"
|
|
943
|
+
data-menu-item
|
|
944
|
+
@click="assistant.togglePluginContext(entry.key)"
|
|
945
|
+
>
|
|
946
|
+
<Plug :size="16" />
|
|
947
|
+
<span class="assistant-menu-label">@{{ entry.provider.id }} · {{ entry.provider.label }}</span>
|
|
948
|
+
<Check v-if="assistant.pluginContextKeys.includes(entry.key)" :size="16" class="assistant-menu-check" />
|
|
949
|
+
</button>
|
|
950
|
+
</template>
|
|
719
951
|
<div class="assistant-menu-divider" />
|
|
720
952
|
<button class="assistant-menu-item" :disabled="assistant.demo || assistant.canConfigure === false || controlsLocked" data-menu-item @click="closePopover(); emit('openSettings')"><Plug :size="18" /><span class="assistant-menu-label">{{ t('添加模型连接') }}</span><span v-if="assistant.demo" class="assistant-menu-badge">{{ t('桌面版') }}</span></button>
|
|
721
953
|
</template>
|
|
@@ -744,9 +976,125 @@ watch(() => [assistant.session?.messages.map(message => `${message.content.lengt
|
|
|
744
976
|
</div>
|
|
745
977
|
<p class="assistant-reasoning-help">{{ t('用于当前对话。可用强度取决于所选模型。') }}</p>
|
|
746
978
|
</div>
|
|
979
|
+
<div v-surface-motion="'AssistantPanel:8'" v-if="popover === 'capabilities'" id="assistant-capability-options" class="assistant-popover assistant-capability-menu" :style="menuPosition" role="dialog" :aria-label="t('当前会话插件能力')">
|
|
980
|
+
<div class="assistant-popover-heading"><span>{{ t('当前会话可用能力') }}</span></div>
|
|
981
|
+
<div v-if="safeMode" class="assistant-capability-banner warning" role="status">
|
|
982
|
+
<span>{{ t('安全模式已开启:已暂停第三方代码插件与工作台扩展覆盖。') }}</span>
|
|
983
|
+
<button type="button" class="assistant-capability-action" @click="exitSafeMode">{{ t('退出安全模式') }}</button>
|
|
984
|
+
</div>
|
|
985
|
+
<div v-else-if="personalCodePolicy === 'block'" class="assistant-capability-banner warning" role="status">
|
|
986
|
+
<span>{{ t('团队工作区策略:已屏蔽个人代码插件。') }}</span>
|
|
987
|
+
</div>
|
|
988
|
+
<div v-else-if="personalCodePolicy === 'read-only'" class="assistant-capability-banner warning" role="status">
|
|
989
|
+
<span>{{ t('团队工作区策略:个人代码插件仅允许只读操作,写入工具已禁用。') }}</span>
|
|
990
|
+
</div>
|
|
991
|
+
<div v-if="workspaceReadOnly" class="assistant-capability-banner warning" role="status">
|
|
992
|
+
<span>{{ t('当前工作区为只读,所有写入型插件工具已禁用。') }}</span>
|
|
993
|
+
</div>
|
|
994
|
+
<div class="assistant-menu-scroll panel-scrollbar">
|
|
995
|
+
<section v-if="extensionCapabilityNotes.length" class="assistant-capability-group">
|
|
996
|
+
<h4>{{ t('工作台扩展能力') }}</h4>
|
|
997
|
+
<div v-for="item in extensionCapabilityNotes" :key="item.id" class="assistant-capability-row" :class="{ warning: item.tone === 'warning' }">
|
|
998
|
+
<strong>{{ item.label }}</strong>
|
|
999
|
+
<small v-if="item.detail">{{ item.detail }}</small>
|
|
1000
|
+
</div>
|
|
1001
|
+
</section>
|
|
1002
|
+
<section v-if="pluginCapabilities.contexts.length" class="assistant-capability-group">
|
|
1003
|
+
<h4>{{ t('可用 @ 上下文(输入 @ 快速联想)') }}</h4>
|
|
1004
|
+
<button
|
|
1005
|
+
v-for="entry in pluginCapabilities.contexts"
|
|
1006
|
+
:key="`cap-ctx-${entry.key}`"
|
|
1007
|
+
type="button"
|
|
1008
|
+
class="assistant-menu-item"
|
|
1009
|
+
:class="{ selected: assistant.pluginContextKeys.includes(entry.key) }"
|
|
1010
|
+
:aria-pressed="assistant.pluginContextKeys.includes(entry.key)"
|
|
1011
|
+
:disabled="controlsLocked"
|
|
1012
|
+
data-menu-item
|
|
1013
|
+
@click="assistant.togglePluginContext(entry.key)"
|
|
1014
|
+
>
|
|
1015
|
+
<Plug :size="14" />
|
|
1016
|
+
<span class="assistant-capability-item-text">
|
|
1017
|
+
<span>{{ formatPluginMentionToken(entry, pluginCapabilities.contexts) }} · {{ entry.provider.label }}</span>
|
|
1018
|
+
<small>{{ entry.pluginName }} · {{ entry.provider.description }}</small>
|
|
1019
|
+
</span>
|
|
1020
|
+
<Check v-if="assistant.pluginContextKeys.includes(entry.key)" :size="15" class="assistant-menu-check" />
|
|
1021
|
+
</button>
|
|
1022
|
+
</section>
|
|
1023
|
+
<section v-if="pluginCapabilities.tools.length" class="assistant-capability-group">
|
|
1024
|
+
<h4>{{ t('插件工具') }}</h4>
|
|
1025
|
+
<div
|
|
1026
|
+
v-for="item in pluginCapabilities.tools"
|
|
1027
|
+
:key="item.wireName"
|
|
1028
|
+
class="assistant-capability-row"
|
|
1029
|
+
:class="{ disabled: !item.available }"
|
|
1030
|
+
>
|
|
1031
|
+
<div class="assistant-capability-row-head">
|
|
1032
|
+
<strong>{{ item.pluginName }} · {{ item.tool.label }}</strong>
|
|
1033
|
+
<span class="assistant-menu-badge">
|
|
1034
|
+
{{ item.tool.effect === 'read' ? t('只读') : item.tool.effect === 'external' ? t('外发 · 需确认') : t('写入 · 需确认') }}
|
|
1035
|
+
</span>
|
|
1036
|
+
</div>
|
|
1037
|
+
<small>{{ item.available ? item.tool.description : blockedToolReasonLabel(item.blockedReason) }}</small>
|
|
1038
|
+
</div>
|
|
1039
|
+
</section>
|
|
1040
|
+
<p v-if="!pluginCapabilities.tools.length && !pluginCapabilities.contexts.length && !extensionCapabilityNotes.length" class="assistant-menu-empty">
|
|
1041
|
+
{{ t('当前会话暂无已授权插件工具或上下文') }}
|
|
1042
|
+
</p>
|
|
1043
|
+
</div>
|
|
1044
|
+
</div>
|
|
1045
|
+
<div
|
|
1046
|
+
v-if="mentionMenuOpen"
|
|
1047
|
+
id="assistant-mention-options"
|
|
1048
|
+
class="assistant-popover assistant-mention-menu"
|
|
1049
|
+
role="listbox"
|
|
1050
|
+
:aria-label="t('插件上下文联想')"
|
|
1051
|
+
>
|
|
1052
|
+
<div class="assistant-popover-heading">
|
|
1053
|
+
<span>{{ t('引用插件上下文') }}</span>
|
|
1054
|
+
<small>{{ t('↑↓ 选择 · Enter 确认') }}</small>
|
|
1055
|
+
</div>
|
|
1056
|
+
<div class="assistant-menu-scroll panel-scrollbar">
|
|
1057
|
+
<button
|
|
1058
|
+
v-for="(entry, index) in mentionProviders"
|
|
1059
|
+
:id="`assistant-mention-item-${index}`"
|
|
1060
|
+
:key="entry.key"
|
|
1061
|
+
type="button"
|
|
1062
|
+
role="option"
|
|
1063
|
+
class="assistant-menu-item assistant-mention-option"
|
|
1064
|
+
:class="{ selected: index === mentionActiveIndex }"
|
|
1065
|
+
:aria-selected="index === mentionActiveIndex"
|
|
1066
|
+
@mouseenter="mentionActiveIndex = index"
|
|
1067
|
+
@mousedown.prevent="selectMention(entry)"
|
|
1068
|
+
>
|
|
1069
|
+
<Plug :size="14" />
|
|
1070
|
+
<span class="assistant-mention-body">
|
|
1071
|
+
<span class="assistant-mention-title">
|
|
1072
|
+
<code>{{ formatPluginMentionToken(entry, workspace.pluginContextProviders) }}</code>
|
|
1073
|
+
<span>{{ entry.provider.label }}</span>
|
|
1074
|
+
</span>
|
|
1075
|
+
<small>{{ entry.pluginName }} · {{ entry.provider.description }}</small>
|
|
1076
|
+
</span>
|
|
1077
|
+
<Check v-if="assistant.pluginContextKeys.includes(entry.key)" :size="14" class="assistant-menu-check" />
|
|
1078
|
+
</button>
|
|
1079
|
+
<p v-if="!mentionProviders.length" class="assistant-menu-empty">{{ t('没有匹配的插件上下文') }}</p>
|
|
1080
|
+
</div>
|
|
1081
|
+
</div>
|
|
747
1082
|
<AssistantQuestionCard v-if="assistant.pendingUserInput" :key="assistant.pendingUserInput.request.id" :request="assistant.pendingUserInput.request" />
|
|
748
1083
|
<form v-else class="assistant-composer" @submit.prevent="closePopover(); assistant.send()">
|
|
749
|
-
<div v-if="assistant.files.length || assistant.selection || assistant.attachments.length" class="assistant-contexts">
|
|
1084
|
+
<div v-if="assistant.files.length || assistant.selection || assistant.attachments.length || assistant.pluginContextKeys.length" class="assistant-contexts">
|
|
1085
|
+
<button
|
|
1086
|
+
v-for="key in assistant.pluginContextKeys"
|
|
1087
|
+
:key="`plugin-ctx-${key}`"
|
|
1088
|
+
type="button"
|
|
1089
|
+
class="assistant-context"
|
|
1090
|
+
:disabled="controlsLocked"
|
|
1091
|
+
:data-tooltip="t('移除插件上下文:{0}', [workspace.pluginContextProviders.find(item => item.key === key)?.provider.label ?? key])"
|
|
1092
|
+
@click="assistant.togglePluginContext(key)"
|
|
1093
|
+
>
|
|
1094
|
+
<Plug :size="13" />
|
|
1095
|
+
<span>@{{ workspace.pluginContextProviders.find(item => item.key === key)?.provider.id ?? key }}</span>
|
|
1096
|
+
<X :size="12" />
|
|
1097
|
+
</button>
|
|
750
1098
|
<button v-for="id in assistant.files.filter(id => id !== assistant.selection?.fileId)" :key="id" type="button" class="assistant-context" :disabled="assistant.busy" :data-tooltip="t('移除参考:{0}', [workspace.workspace?.files.find(file => file.id === id)?.path ?? id])" @click="toggleSource(id)"><FileText :size="13" /><span>{{ workspace.workspace?.files.find(file => file.id === id)?.name ?? t('已移除文档') }}</span><X :size="12" /></button>
|
|
751
1099
|
<div v-if="assistant.selection" class="assistant-context assistant-selection" :title="`${workspace.workspace?.files.find(file => file.id === assistant.selection?.fileId)?.path ?? assistant.selection.fileId}\n${assistant.selection.text}`" :aria-label="t('引用文字:{0}', [assistant.selection.text])"><Quote :size="13" /><span>{{ assistant.selection.text }}</span><button type="button" class="icon-button" :aria-label="t('清除助手选区')" :data-tooltip="t('清除选区')" :disabled="assistant.busy" @click="assistant.selection = null"><X :size="13" /></button></div>
|
|
752
1100
|
<button v-for="attachment in assistant.attachments" :key="attachment.id" type="button" class="assistant-context"
|
|
@@ -755,9 +1103,42 @@ watch(() => [assistant.session?.messages.map(message => `${message.content.lengt
|
|
|
755
1103
|
<component :is="attachment.kind === 'image' ? ImageIcon : FileText" :size="13" /><span>{{ attachment.name }}</span><X :size="12" />
|
|
756
1104
|
</button>
|
|
757
1105
|
</div>
|
|
758
|
-
<textarea
|
|
1106
|
+
<textarea
|
|
1107
|
+
ref="textarea"
|
|
1108
|
+
v-model="assistant.prompt"
|
|
1109
|
+
rows="2"
|
|
1110
|
+
maxlength="20000"
|
|
1111
|
+
:aria-label="t('给助手的任务')"
|
|
1112
|
+
:placeholder="t('问问同页助手…')"
|
|
1113
|
+
:aria-expanded="mentionMenuOpen || undefined"
|
|
1114
|
+
:aria-controls="mentionMenuOpen ? 'assistant-mention-options' : undefined"
|
|
1115
|
+
:aria-activedescendant="mentionMenuOpen && mentionProviders[mentionActiveIndex] ? `assistant-mention-item-${mentionActiveIndex}` : undefined"
|
|
1116
|
+
@input="onComposerInput"
|
|
1117
|
+
@click="refreshMentionTrigger"
|
|
1118
|
+
@keyup="onComposerKeyup"
|
|
1119
|
+
@compositionstart="isComposing = true"
|
|
1120
|
+
@compositionend="isComposing = false; refreshMentionTrigger()"
|
|
1121
|
+
@keydown="sendKey"
|
|
1122
|
+
@paste="pasteAttachments"
|
|
1123
|
+
/>
|
|
759
1124
|
<div class="assistant-compose-actions">
|
|
760
1125
|
<button type="button" class="icon-button assistant-compose-tool" :data-tooltip="t('添加内容')" :aria-label="t('添加内容')" :disabled="controlsLocked" :aria-expanded="popover === 'add'" aria-controls="assistant-add-options" data-assistant-popover @click="togglePopover('add', $event)"><Plus :size="20" /></button>
|
|
1126
|
+
<button
|
|
1127
|
+
v-if="showCapabilityPill"
|
|
1128
|
+
type="button"
|
|
1129
|
+
class="assistant-compose-capabilities"
|
|
1130
|
+
:class="{ restricted: hasCapabilityRestriction }"
|
|
1131
|
+
:data-tooltip="t('查看当前会话可用插件工具与上下文')"
|
|
1132
|
+
:aria-label="t('查看当前会话可用插件工具与上下文')"
|
|
1133
|
+
:aria-expanded="popover === 'capabilities'"
|
|
1134
|
+
aria-controls="assistant-capability-options"
|
|
1135
|
+
data-assistant-popover
|
|
1136
|
+
@click="togglePopover('capabilities', $event)"
|
|
1137
|
+
>
|
|
1138
|
+
<ShieldAlert v-if="hasCapabilityRestriction" :size="13" />
|
|
1139
|
+
<Plug v-else :size="13" />
|
|
1140
|
+
<span>{{ capabilityPillLabel }}</span>
|
|
1141
|
+
</button>
|
|
761
1142
|
<button type="button" class="assistant-compose-model" :data-tooltip="`${assistant.connection?.name ?? t('模型连接')} · ${modelLabel}`" :aria-label="t('选择助手模型')" :aria-expanded="popover === 'model'" aria-controls="assistant-model-options" data-assistant-popover @click="togglePopover('model', $event)"><span>{{ modelLabel }}</span></button>
|
|
762
1143
|
<button v-if="assistant.connection?.kind === 'codex-cli'" type="button" class="assistant-compose-reasoning" :data-tooltip="t('推理强度:{0}', [reasoningLabel])" :aria-label="t('选择推理强度')" :disabled="controlsLocked" :aria-expanded="popover === 'reasoning'" aria-controls="assistant-reasoning-options" data-assistant-popover @click="togglePopover('reasoning', $event)"><span>{{ reasoningLabel }}</span></button>
|
|
763
1144
|
<button v-if="assistant.busy" type="button" class="icon-button assistant-stop" :aria-label="t('停止助手生成')" :data-tooltip="t('停止生成')" @click="assistant.stop()"><Square :size="16" /></button><button v-else class="primary-button assistant-send" :aria-label="t('发送给助手')" :data-tooltip="t('发送')" :disabled="!assistant.hasDraft || !assistant.connection || !assistant.modelId || assistant.loading || assistant.applying"><ArrowUp :size="18" /></button>
|
|
@@ -910,6 +1291,10 @@ watch(() => [assistant.session?.messages.map(message => `${message.content.lengt
|
|
|
910
1291
|
.assistant-starter { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 38px; padding: 7px 8px; margin-left: -8px; border-radius: 6px; color: var(--text-secondary); text-align: left; font-size: 14px; }
|
|
911
1292
|
.assistant-starters button svg { flex-shrink: 0; }
|
|
912
1293
|
.assistant-starters button:hover:not(:disabled) { background: var(--surface); color: var(--text); }
|
|
1294
|
+
.assistant-extension-starters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
|
|
1295
|
+
.assistant-extension-starter { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--text-secondary); font-size: 12px; }
|
|
1296
|
+
.assistant-extension-starter:hover:not(:disabled) { border-color: var(--control-border); color: var(--text); }
|
|
1297
|
+
.assistant-extension-starter svg { flex-shrink: 0; color: var(--muted); }
|
|
913
1298
|
.assistant-conversation-meta { flex: 0 0 auto; padding: 4px 0 18px; color: var(--muted); font-size: 11px; text-align: center; }
|
|
914
1299
|
.assistant-message { flex-shrink: 0; width: 100%; padding: 10px 0 4px; }
|
|
915
1300
|
.assistant-message-user { display: flex; flex-direction: column; align-items: flex-end; color: var(--text-secondary); }
|
|
@@ -917,6 +1302,9 @@ watch(() => [assistant.session?.messages.map(message => `${message.content.lengt
|
|
|
917
1302
|
.assistant-message-user .assistant-message-text { max-width: 88%; padding: 10px 16px; border-radius: 22px; background: var(--surface); color: var(--text); }
|
|
918
1303
|
.assistant-message-assistant { padding-top: 24px; }
|
|
919
1304
|
.assistant-answer { min-width: 0; font-size: 14px; line-height: 1.75; overflow-wrap: anywhere; }
|
|
1305
|
+
/* Answers fill the message column; the document reading measure and block rail would center and indent them. */
|
|
1306
|
+
.assistant-answer :deep(.milkdown-host) { max-width: none; margin: 0; }
|
|
1307
|
+
.assistant-answer :deep(.tano-prose) { --tano-block-padding-inline: 0px; }
|
|
920
1308
|
.assistant-answer :deep(.ProseMirror) { padding: 0; min-height: 0; font-size: 14px; line-height: 1.75; }
|
|
921
1309
|
.assistant-answer :deep(.frontmatter-panel) { display: none; }
|
|
922
1310
|
.assistant-answer :deep(h1), .assistant-answer :deep(h2), .assistant-answer :deep(h3) { font-size: 16px; line-height: 1.5; margin: 12px 0 6px; }
|
|
@@ -972,6 +1360,35 @@ watch(() => [assistant.session?.messages.map(message => `${message.content.lengt
|
|
|
972
1360
|
.assistant-compose-tool { flex: 0 0 28px; width: 28px; height: 28px; border-radius: 6px; color: var(--assistant-composer-muted); }
|
|
973
1361
|
.assistant-compose-tool[aria-expanded='true'] { background: var(--surface); }
|
|
974
1362
|
.assistant-compose-tool:hover, .assistant-compose-tool[aria-expanded='true'] { color: var(--text-secondary); }
|
|
1363
|
+
.assistant-compose-capabilities { display: inline-flex; align-items: center; gap: 4px; max-width: 44%; min-width: 0; height: 26px; padding: 0 7px; margin-left: 3px; border-radius: 999px; border: 1px solid transparent; background: color-mix(in srgb, var(--surface) 70%, var(--paper)); color: var(--assistant-composer-muted); font-size: 11px; white-space: nowrap; }
|
|
1364
|
+
.assistant-compose-capabilities span { overflow: hidden; text-overflow: ellipsis; }
|
|
1365
|
+
.assistant-compose-capabilities svg { flex-shrink: 0; }
|
|
1366
|
+
.assistant-compose-capabilities:hover, .assistant-compose-capabilities[aria-expanded='true'] { background: var(--surface); color: var(--text-secondary); }
|
|
1367
|
+
.assistant-compose-capabilities.restricted { border-color: color-mix(in srgb, var(--warning, #b97a16) 35%, transparent); background: color-mix(in srgb, var(--warning, #b97a16) 12%, var(--paper)); color: var(--warning, #9a620b); }
|
|
1368
|
+
.assistant-capability-menu { z-index: 70; width: min(336px, 100%); max-height: min(420px, var(--assistant-menu-max-height)); display: flex; flex-direction: column; overflow: hidden; }
|
|
1369
|
+
.assistant-capability-banner { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 4px 6px 6px; padding: 6px 8px; border-radius: 6px; font-size: 11px; line-height: 1.45; }
|
|
1370
|
+
.assistant-capability-banner.warning { background: color-mix(in srgb, var(--warning, #b97a16) 12%, var(--paper)); color: var(--warning, #9a620b); }
|
|
1371
|
+
.assistant-capability-action { flex-shrink: 0; padding: 2px 7px; border: 1px solid currentColor; border-radius: 4px; background: transparent; color: inherit; font-size: 11px; }
|
|
1372
|
+
.assistant-capability-group { padding: 4px 2px; }
|
|
1373
|
+
.assistant-capability-group + .assistant-capability-group { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
|
|
1374
|
+
.assistant-capability-group h4 { margin: 0 0 4px; padding: 0 6px; color: var(--muted); font-size: 11px; font-weight: 500; }
|
|
1375
|
+
.assistant-capability-row { display: grid; gap: 2px; padding: 5px 7px; border-radius: 6px; }
|
|
1376
|
+
.assistant-capability-row.warning { color: var(--warning, #9a620b); }
|
|
1377
|
+
.assistant-capability-row.disabled { opacity: 0.6; }
|
|
1378
|
+
.assistant-capability-row-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
|
|
1379
|
+
.assistant-capability-row strong { font-size: 12px; font-weight: 500; color: var(--text); }
|
|
1380
|
+
.assistant-capability-row small { color: var(--muted); font-size: 11px; line-height: 1.4; }
|
|
1381
|
+
.assistant-capability-item-text { display: grid; flex: 1; min-width: 0; gap: 1px; }
|
|
1382
|
+
.assistant-capability-item-text > span { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1383
|
+
.assistant-capability-item-text small { color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1384
|
+
.assistant-mention-menu { z-index: 75; left: 0; right: 0; bottom: calc(100% + 6px); display: flex; flex-direction: column; overflow: hidden; max-height: min(260px, var(--assistant-menu-max-height)); }
|
|
1385
|
+
.assistant-mention-option { align-items: flex-start; padding: 6px 8px; }
|
|
1386
|
+
.assistant-mention-option > svg { margin-top: 2px; }
|
|
1387
|
+
.assistant-mention-body { display: grid; flex: 1; min-width: 0; gap: 2px; }
|
|
1388
|
+
.assistant-mention-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
|
|
1389
|
+
.assistant-mention-title code { padding: 1px 4px; border-radius: 4px; background: var(--surface); color: var(--text); font-size: 11px; }
|
|
1390
|
+
.assistant-mention-title > span { color: var(--text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1391
|
+
.assistant-mention-body small { color: var(--muted); font-size: 11px; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
975
1392
|
.assistant-compose-model { display: inline-flex; align-items: center; min-width: 0; max-width: 52%; margin-left: auto; padding: 6px 5px; border-radius: 10px; color: var(--assistant-composer-muted); font-size: 12px; }
|
|
976
1393
|
.assistant-compose-model span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
977
1394
|
.assistant-compose-model:hover, .assistant-compose-model[aria-expanded='true'] { background: var(--surface); color: var(--text-secondary); }
|