@vetta-org/theme-ui 0.1.1 → 0.1.2
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 +733 -5
- package/src/action-approval/AppearanceActionPickerView.tsx +2 -78
- package/src/action-approval/AppearanceApprovalDrawerView.tsx +2 -9
- package/src/action-approval/BatchTasksApprovalFrameView.tsx +4 -1
- package/src/action-approval/GenericActionApprovalView.tsx +2 -9
- package/src/action-approval/ManageActionApprovalFrameView.tsx +4 -1
- package/src/action-approval/NavigationOpenApprovalView.tsx +2 -9
- package/src/action-approval/SchedulerActionApprovalDialogView.tsx +3 -1
- package/src/action-approval/SchedulerEditApprovalDrawerView.tsx +3 -10
- package/src/action-approval/index.ts +0 -1
- package/src/activity/ActivityPanel.tsx +13 -10
- package/src/activity/ActivityPanelFrame.test.tsx +32 -0
- package/src/activity/ActivityPanelFrame.tsx +3 -2
- package/src/activity/BackgroundTasksTabPanelView.tsx +1 -1
- package/src/activity/BrowserPanelView.tsx +48 -49
- package/src/activity/DebugTabPanelView.tsx +1 -1
- package/src/activity/MarkdownPreviewView.tsx +56 -59
- package/src/activity/PluginTabPickerView.tsx +5 -3
- package/src/activity/PortsTabPanelView.tsx +911 -0
- package/src/activity/ToolCallsSubTabView.tsx +1 -1
- package/src/activity/WorkflowTabPanelView.tsx +1 -1
- package/src/activity/index.ts +9 -0
- package/src/app/AppBackground.tsx +1 -1
- package/src/app/AppBootLoadingView.tsx +4 -2
- package/src/app-shell/DefaultWindowControls.tsx +1 -1
- package/src/app-shell/PageHeaderActionGroup.tsx +1 -1
- package/src/app-shell/PageHeaderContent.tsx +36 -7
- package/src/app-shell/PageHeaderFrame.tsx +15 -3
- package/src/app-shell/PageHeaderSidebarTrigger.tsx +1 -1
- package/src/app-shell/PageHeaderTitle.tsx +1 -1
- package/src/app-shell/WindowControlButton.tsx +1 -1
- package/src/app-shell/header-crowding.test.ts +62 -0
- package/src/app-shell/header-crowding.tsx +137 -0
- package/src/appearance/BackgroundImageFrame.tsx +1 -1
- package/src/appearance/CenterSliceImageFrame.tsx +1 -1
- package/src/appearance/CornerImageFrame.tsx +1 -1
- package/src/appearance/HorizontalSliceImageFrame.tsx +1 -1
- package/src/appearance/NineSliceImageFrame.tsx +1 -1
- package/src/appearance/ThemeSurface.tsx +1 -1
- package/src/batch-tasks/BatchProjectFoldersFieldView.tsx +2 -1
- package/src/batch-tasks/BatchTaskProjectActionsView.test.tsx +97 -0
- package/src/batch-tasks/BatchTaskProjectActionsView.tsx +45 -35
- package/src/batch-tasks/batchTaskUi.tsx +0 -29
- package/src/bottom-panel/BottomPanelView.test.tsx +43 -0
- package/src/bottom-panel/BottomPanelView.tsx +222 -0
- package/src/bottom-panel/index.ts +26 -0
- package/src/chat/AgentAvatarView.tsx +1 -1
- package/src/chat/AnnotationViews.tsx +107 -0
- package/src/chat/AskUserQuestionView.tsx +18 -11
- package/src/chat/AssistantMessageView.tsx +48 -13
- package/src/chat/AtPanelView.test.tsx +61 -0
- package/src/chat/AtPanelView.tsx +63 -38
- package/src/chat/BashTerminalCard.tsx +1 -2
- package/src/chat/ChatHeaderActionsView.tsx +74 -18
- package/src/chat/CompactionStepView.test.tsx +34 -0
- package/src/chat/CompactionStepView.tsx +85 -0
- package/src/chat/ExecutionModeSelectorView.tsx +20 -5
- package/src/chat/HeaderActionBarView.tsx +731 -0
- package/src/chat/HeaderActionOverflowMenu.tsx +137 -0
- package/src/chat/InlineModelPicker.test.tsx +81 -0
- package/src/chat/InlineModelPicker.tsx +201 -0
- package/src/chat/InlineTokenChip.tsx +2 -68
- package/src/chat/InputBarBackground.tsx +1 -1
- package/src/chat/InputBarPlaceholder.tsx +26 -3
- package/src/chat/LiveThinkingView.tsx +51 -37
- package/src/chat/MessageBoundaryViews.tsx +21 -0
- package/src/chat/MessageFeedContext.tsx +13 -5
- package/src/chat/MessageFeedLayoutView.tsx +28 -3
- package/src/chat/MessageFeedView.test.tsx +81 -0
- package/src/chat/MessageFeedView.tsx +72 -152
- package/src/chat/MessageInputView.tsx +1 -1
- package/src/chat/MessageLayoutView.tsx +1 -1
- package/src/chat/MessageSelectionContextMenuView.tsx +4 -1
- package/src/chat/MessageTimelineView.tsx +1 -1
- package/src/chat/MessageView.tsx +1 -1
- package/src/chat/MessageVisualView.tsx +1 -1
- package/src/chat/ModelConfiguration.tsx +283 -0
- package/src/chat/ModelSelectorTrigger.tsx +63 -0
- package/src/chat/ModelSelectorView.tsx +1037 -223
- package/src/chat/NewSession.ts +1 -37
- package/src/chat/NewSessionPicker.tsx +3 -2
- package/src/chat/ProjectSelectorView.tsx +3 -2
- package/src/chat/ReasoningStepSlider.tsx +61 -0
- package/src/chat/RemoteSessionBadgeView.tsx +24 -0
- package/src/chat/SkillPromptAreaView.tsx +5 -19
- package/src/chat/TeamMemberReplyCardView.test.tsx +33 -0
- package/src/chat/TeamMemberReplyCardView.tsx +133 -0
- package/src/chat/TextBlockView.tsx +7 -770
- package/src/chat/TodoProgress.tsx +25 -53
- package/src/chat/TodoStatusBarView.tsx +14 -5
- package/src/chat/UserMessageView.tsx +113 -33
- package/src/chat/header-action-narrow.test.ts +21 -0
- package/src/chat/header-action-narrow.ts +38 -0
- package/src/chat/index.ts +32 -27
- package/src/chat/markdown-link.ts +7 -279
- package/src/chat/send-button.css +4 -22
- package/src/chat/streaming-reveal.test.ts +218 -0
- package/src/chat/streaming-reveal.ts +13 -0
- package/src/file-explorer/ConfirmDeleteDialogView.tsx +2 -1
- package/src/file-explorer/FileContextMenuView.tsx +44 -11
- package/src/file-explorer/FileExplorerSettingsView.tsx +97 -0
- package/src/file-explorer/FileTreeCreateRow.tsx +1 -1
- package/src/file-explorer/FileTreeNodeView.tsx +59 -18
- package/src/file-explorer/FileTreeView.tsx +236 -129
- package/src/file-explorer/file-tree-dom.ts +23 -0
- package/src/file-explorer/file-tree-rows.test.ts +74 -0
- package/src/file-explorer/file-tree-rows.ts +168 -0
- package/src/file-explorer/index.ts +17 -0
- package/src/file-explorer/types.ts +3 -0
- package/src/file-explorer/useFileTreeMarqueeSelection.ts +24 -16
- package/src/file-preview/FilePreviewDialogView.tsx +2 -2
- package/src/file-preview/FilePreviewView.tsx +12 -2
- package/src/file-preview/TextFileEditorView.tsx +2 -1
- package/src/index.ts +1 -0
- package/src/knowledge/KnowledgeHowItWorksDialogView.tsx +1 -1
- package/src/layout/AppFrame.tsx +3 -2
- package/src/layout/MainContentFrame.tsx +7 -2
- package/src/layout/ResizeHandle.tsx +68 -17
- package/src/layout/SidebarDock.tsx +75 -19
- package/src/layout/SidebarOverlay.tsx +1 -1
- package/src/layout/index.ts +1 -1
- package/src/layout/resize-handle-axis.test.ts +51 -0
- package/src/live-indicators.test.ts +43 -0
- package/src/markdown/CodeBlock.tsx +123 -0
- package/src/markdown/InlineTokenChip.tsx +68 -0
- package/src/markdown/MarkdownContent.tsx +411 -0
- package/src/markdown/MarkdownImage.tsx +51 -0
- package/src/markdown/MathFormula.tsx +46 -0
- package/src/markdown/MermaidBlock.tsx +43 -0
- package/src/markdown/RichCodeBlock.tsx +127 -0
- package/src/markdown/SvgPreview.tsx +45 -0
- package/src/markdown/WebsiteIcon.tsx +94 -0
- package/src/markdown/builtin-renderers.tsx +43 -0
- package/src/markdown/definition.tsx +49 -0
- package/src/markdown/host.tsx +18 -0
- package/src/markdown/index.ts +11 -0
- package/src/markdown/inline-tokens.ts +187 -0
- package/src/markdown/markdown-link.ts +279 -0
- package/src/markdown/math-client.ts +116 -0
- package/src/markdown/math-render.ts +23 -0
- package/src/markdown/math-syntax.ts +80 -0
- package/src/markdown/math.worker.ts +16 -0
- package/src/markdown/nodes.ts +15 -0
- package/src/markdown/preview-policy.ts +43 -0
- package/src/markdown/rich-labels.ts +49 -0
- package/src/markdown/rich-syntax.ts +93 -0
- package/src/markdown/stable-blocks.test.ts +90 -0
- package/src/markdown/stable-blocks.ts +124 -0
- package/src/markdown/streaming-reveal.ts +297 -0
- package/src/markdown/streaming.test.ts +57 -0
- package/src/markdown/streaming.ts +211 -0
- package/src/markdown/use-render-snapshot.ts +24 -0
- package/src/markdown/use-rich-visibility.ts +24 -0
- package/src/overlays/CommandMenuRow.tsx +38 -9
- package/src/overlays/CommandMenuView.tsx +77 -117
- package/src/overlays/ConfirmDialogView.tsx +25 -20
- package/src/overlays/ReleaseNoteMarkdown.tsx +29 -0
- package/src/overlays/SplashOptionRow.tsx +46 -0
- package/src/overlays/SplashPanel.tsx +85 -0
- package/src/overlays/SplashParts.tsx +213 -0
- package/src/overlays/UpdateCheckerView.tsx +34 -18
- package/src/overlays/UpdateRestartDialogView.tsx +139 -54
- package/src/overlays/command-menu-types.ts +2 -0
- package/src/overlays/command-menu.css +1 -20
- package/src/overlays/index.ts +14 -1
- package/src/plugin-ui/index.ts +8 -0
- package/src/project/ConversationTagDotsView.tsx +1 -1
- package/src/project/ConversationTagEditorDialogView.tsx +4 -1
- package/src/project/DefaultConversationSectionView.tsx +4 -4
- package/src/project/DefaultSessionListView.tsx +5 -31
- package/src/project/DefaultSessionRowView.tsx +106 -55
- package/src/project/ManageSessionsSplashView.tsx +439 -0
- package/src/project/NewProjectDialogView.tsx +3 -10
- package/src/project/ProjectContextMenuView.tsx +30 -139
- package/src/project/ProjectDetailPageView.test.tsx +140 -0
- package/src/project/ProjectDetailPageView.tsx +372 -165
- package/src/project/ProjectGroupView.tsx +1 -1
- package/src/project/ProjectRowView.tsx +29 -12
- package/src/project/ProjectSessionsView.tsx +25 -47
- package/src/project/QuickScrollOverlay.tsx +1 -1
- package/src/project/SessionContextMenuView.tsx +15 -7
- package/src/project/SessionRowMoreButton.tsx +50 -0
- package/src/project/SessionRowView.tsx +106 -63
- package/src/project/SessionTitleMarquee.tsx +54 -0
- package/src/project/SidebarProjectDisclosure.tsx +60 -0
- package/src/project/SidebarProjectsSectionView.tsx +6 -1
- package/src/project/index.ts +12 -0
- package/src/project/session-row-transition.ts +9 -0
- package/src/project/types.ts +4 -2
- package/src/project/useActiveSessionAutoScroll.ts +10 -4
- package/src/registry.ts +0 -2
- package/src/scheduler/AutomationDetailPaneView.tsx +68 -0
- package/src/scheduler/AutomationPageView.tsx +118 -121
- package/src/scheduler/ExecutionHistoryView.tsx +7 -5
- package/src/scheduler/TaskListView.tsx +52 -201
- package/src/scheduler/index.ts +7 -12
- package/src/settings/AchievementSettingsView.tsx +0 -1
- package/src/settings/AppshotSettingsView.tsx +0 -1
- package/src/settings/BuiltinMcpSectionView.tsx +1 -1
- package/src/settings/EnvironmentGitRowView.tsx +156 -0
- package/src/settings/EnvironmentSettingsView.tsx +25 -3
- package/src/settings/GeneralSettingsView.tsx +17 -20
- package/src/settings/ImChannelGuideDialogView.tsx +2 -2
- package/src/settings/ImFeishuDialogView.tsx +1 -1
- package/src/settings/ImLegacyImportBannerView.tsx +1 -1
- package/src/settings/ImLogDrawerView.tsx +2 -1
- package/src/settings/JsonConfigInputView.tsx +171 -0
- package/src/settings/ModelsFetchedModelsDrawerView.tsx +292 -0
- package/src/settings/ModelsProvidersSectionView.tsx +26 -23
- package/src/settings/MotionSelect.tsx +9 -7
- package/src/settings/NotificationSettingsView.tsx +79 -0
- package/src/settings/PermissionsSettingsView.tsx +3 -7
- package/src/settings/PresetProviderModelsListView.tsx +141 -24
- package/src/settings/PresetProviderRowView.tsx +205 -182
- package/src/settings/ProxySettingsSectionView.tsx +182 -0
- package/src/settings/QrBindDialogView.tsx +1 -1
- package/src/settings/QuickPanelSettingsSectionView.tsx +0 -2
- package/src/settings/RemoteMcpSectionView.tsx +1 -1
- package/src/settings/SettingChrome.tsx +2 -2
- package/src/settings/SettingsAiAssistButtonView.tsx +9 -119
- package/src/settings/SettingsFormFields.tsx +4 -7
- package/src/settings/SettingsSidebarView.tsx +64 -3
- package/src/settings/ShortcutRecorderView.test.tsx +108 -0
- package/src/settings/ShortcutRecorderView.tsx +15 -9
- package/src/settings/ShortcutsSettingsView.tsx +1 -1
- package/src/settings/SpaceEditorDialogView.tsx +120 -0
- package/src/settings/SpacesSettingsView.tsx +105 -0
- package/src/settings/WebhookEndpointListView.tsx +4 -5
- package/src/settings/index.ts +41 -29
- package/src/shared/ActivityStatusDot.tsx +69 -0
- package/src/shared/AvatarStackView.tsx +13 -13
- package/src/shared/BotAvatar.tsx +11 -9
- package/src/shared/CodeBlockCopyButton.tsx +1 -1
- package/src/shared/ContextMenuView.tsx +4 -11
- package/src/shared/MarkdownTable.tsx +2 -2
- package/src/shared/SyntaxHighlightedCode.tsx +0 -0
- package/src/shared/TabBar.outline.test.tsx +59 -0
- package/src/shared/TabBar.tsx +22 -17
- package/src/shared/VettaKbd.test.tsx +52 -0
- package/src/shared/VettaKbd.tsx +81 -0
- package/src/shared/connected-tab-outline.test.ts +2 -2
- package/src/shared/connected-tab-outline.ts +2 -1
- package/src/shared/index.ts +6 -0
- package/src/shared/kbd-keys.test.ts +61 -0
- package/src/shared/kbd-keys.ts +253 -0
- package/src/shared/provider-icon/icons.ts +4 -2
- package/src/shared/provider-icon/index.tsx +1 -1
- package/src/shared/provider-icon/magpie.svg +1 -0
- package/src/sidebar/AddProjectMenuTriggerView.tsx +25 -15
- package/src/sidebar/DefaultSidebar.tsx +3 -1
- package/src/sidebar/MessageCenterDialogView.tsx +3 -2
- package/src/sidebar/MessageCenterEmptyState.tsx +1 -1
- package/src/sidebar/MessageCenterTabs.tsx +1 -1
- package/src/sidebar/MessageCenterToolbarButton.tsx +1 -1
- package/src/sidebar/MessageCenterTriggerView.tsx +2 -2
- package/src/sidebar/ProjectsPanelEmptyState.tsx +26 -7
- package/src/sidebar/SessionStatusIcon.tsx +16 -1
- package/src/sidebar/SettingsMenuThemeSection.tsx +1 -1
- package/src/sidebar/SettingsMenuTriggerView.test.tsx +42 -0
- package/src/sidebar/SettingsMenuTriggerView.tsx +28 -50
- package/src/sidebar/ShowMoreSessionsButton.tsx +1 -1
- package/src/sidebar/SidebarFilterSelectView.tsx +8 -16
- package/src/sidebar/SidebarNavBadgeView.tsx +1 -1
- package/src/sidebar/SidebarNavIcon.tsx +1 -1
- package/src/sidebar/SidebarNavItemButton.tsx +1 -1
- package/src/sidebar/SidebarNavMorePanel.tsx +19 -7
- package/src/sidebar/SidebarNavigation.tsx +24 -15
- package/src/sidebar/SidebarPanel.tsx +11 -2
- package/src/sidebar/SidebarSectionTriggerLabel.tsx +20 -0
- package/src/sidebar/SidebarTopBar.tsx +10 -7
- package/src/sidebar/WaitingPulseBadge.tsx +19 -0
- package/src/sidebar/index.ts +1 -16
- package/src/skills/index.ts +0 -19
- package/src/skills/skill-icon.tsx +4 -8
- package/src/styles.css +24 -6
- package/src/chat/DefaultSceneCarousel.tsx +0 -113
- package/src/chat/SceneCard.tsx +0 -138
- package/src/scheduler/HistoryDrawerView.tsx +0 -149
- package/src/scheduler/TaskFormDialogView.tsx +0 -60
- package/src/settings/SubscriptionActionsView.tsx +0 -63
- package/src/settings/SubscriptionCardsView.tsx +0 -212
- package/src/settings/TeamDetailView.tsx +0 -148
- package/src/settings/TeamDialogsView.tsx +0 -151
- package/src/settings/TeamListView.tsx +0 -57
- package/src/settings/TeamSettingsView.tsx +0 -51
- package/src/settings/TokenActivityChartView.tsx +0 -286
- package/src/settings/UsageStatsView.tsx +0 -101
- package/src/settings/shouldCloseEmptyApiKeyEditor.test.ts +0 -135
- package/src/settings/shouldCloseEmptyApiKeyEditor.ts +0 -40
- package/src/settings/token-activity.test.ts +0 -195
- package/src/settings/token-activity.ts +0 -320
- package/src/sidebar/AddProjectMenuItem.tsx +0 -21
- package/src/sidebar/AddProjectMenuPopoverView.tsx +0 -52
- package/src/sidebar/NotificationMessageListView.tsx +0 -136
- package/src/sidebar/SettingsMenuAccountSection.tsx +0 -32
- package/src/sidebar/SettingsMenuQuotaSection.tsx +0 -45
- package/src/skills/SceneCardView.tsx +0 -194
- package/src/skills/SkillCardView.tsx +0 -186
- package/src/skills/SkillDetailDialogView.tsx +0 -138
- package/src/skills/SkillTagGroupView.tsx +0 -56
- package/src/skills/SkillToggleSwitch.tsx +0 -31
|
@@ -2,6 +2,7 @@ import type { JSX, ReactNode } from "react";
|
|
|
2
2
|
import { Button, Switch } from "@vetta-org/ui";
|
|
3
3
|
import { MotionSelect } from "./MotionSelect";
|
|
4
4
|
import { SettingRow, SettingSection, type SettingSectionMeta } from "./SettingChrome";
|
|
5
|
+
import { NotificationSettingsView, type NotificationSettingsViewProps } from "./NotificationSettingsView";
|
|
5
6
|
|
|
6
7
|
export interface GeneralSettingsViewLabels {
|
|
7
8
|
readonly title: string;
|
|
@@ -14,8 +15,6 @@ export interface GeneralSettingsViewLabels {
|
|
|
14
15
|
readonly workspaceDescription: string;
|
|
15
16
|
readonly sandboxTitle: string;
|
|
16
17
|
readonly sandboxDescription: string;
|
|
17
|
-
readonly systemNotifications: string;
|
|
18
|
-
readonly systemNotificationsDescription: string;
|
|
19
18
|
readonly debugMode: string;
|
|
20
19
|
readonly debugModeDescription: string;
|
|
21
20
|
readonly exportDiagnostics: string;
|
|
@@ -36,6 +35,7 @@ export interface GeneralSettingsViewProps {
|
|
|
36
35
|
readonly labels: GeneralSettingsViewLabels;
|
|
37
36
|
readonly sections: {
|
|
38
37
|
readonly basics: SettingSectionMeta;
|
|
38
|
+
readonly notifications: SettingSectionMeta;
|
|
39
39
|
readonly app: SettingSectionMeta;
|
|
40
40
|
readonly developer: SettingSectionMeta;
|
|
41
41
|
};
|
|
@@ -45,17 +45,18 @@ export interface GeneralSettingsViewProps {
|
|
|
45
45
|
/** 与 App 引导同构:description + 右侧 action;有更新时 detail 挂在行下。 */
|
|
46
46
|
readonly updatesDescription: string;
|
|
47
47
|
readonly updatesAction: ReactNode;
|
|
48
|
-
readonly updatesDetail
|
|
48
|
+
readonly updatesDetail?: ReactNode;
|
|
49
49
|
readonly executionMode: string;
|
|
50
50
|
readonly onExecutionModeChange: (mode: string) => void;
|
|
51
51
|
readonly sandboxUnavailableReason: string | null;
|
|
52
|
-
readonly
|
|
53
|
-
readonly onNotificationsChange: (checked: boolean) => void;
|
|
52
|
+
readonly notifications: Omit<NotificationSettingsViewProps, "section">;
|
|
54
53
|
readonly debugMode: boolean;
|
|
55
54
|
readonly onDebugChange: (checked: boolean) => void;
|
|
56
55
|
readonly exportingDiagnostics: boolean;
|
|
57
56
|
readonly onExportDiagnostics: () => void;
|
|
58
57
|
readonly onStartAppGuide: () => void;
|
|
58
|
+
/** 网络代理区块,由宿主注入(需要读 models.json 的服务商列表)。 */
|
|
59
|
+
readonly networkSection?: ReactNode;
|
|
59
60
|
}
|
|
60
61
|
|
|
61
62
|
/**
|
|
@@ -64,6 +65,7 @@ export interface GeneralSettingsViewProps {
|
|
|
64
65
|
*
|
|
65
66
|
* Grouped into 3 sections to reduce one-setting-per-card scatter:
|
|
66
67
|
* - basics: workspace, sandbox, notifications
|
|
68
|
+
* - network: 应用代理(宿主注入)
|
|
67
69
|
* - app: updates, setup guide
|
|
68
70
|
* - developer: debug mode, diagnostics export
|
|
69
71
|
*/
|
|
@@ -79,13 +81,13 @@ export function GeneralSettingsView({
|
|
|
79
81
|
executionMode,
|
|
80
82
|
onExecutionModeChange,
|
|
81
83
|
sandboxUnavailableReason,
|
|
82
|
-
|
|
83
|
-
onNotificationsChange,
|
|
84
|
+
notifications,
|
|
84
85
|
debugMode,
|
|
85
86
|
onDebugChange,
|
|
86
87
|
exportingDiagnostics,
|
|
87
88
|
onExportDiagnostics,
|
|
88
89
|
onStartAppGuide,
|
|
90
|
+
networkSection,
|
|
89
91
|
}: GeneralSettingsViewProps): JSX.Element {
|
|
90
92
|
return (
|
|
91
93
|
<div className="mx-auto w-full max-w-[680px] px-8 pt-2 pb-4">
|
|
@@ -94,15 +96,14 @@ export function GeneralSettingsView({
|
|
|
94
96
|
<SettingSection title={labels.sections.basics} section={sections.basics}>
|
|
95
97
|
<SettingRow title={labels.workspaceTitle} description={labels.workspaceDescription}>
|
|
96
98
|
<div className="flex items-center gap-2">
|
|
97
|
-
<
|
|
99
|
+
<Button variant="field"
|
|
98
100
|
type="button"
|
|
99
101
|
onClick={onSelectWorkspace}
|
|
100
|
-
className="flex items-center gap-2 rounded-lg border border-input bg-secondary px-3 py-1.5 text-[12px] text-foreground transition-colors hover:bg-accent"
|
|
101
102
|
>
|
|
102
103
|
<span className="icon-[mdi--folder-outline] h-3.5 w-3.5 shrink-0 text-muted-foreground" />
|
|
103
104
|
<span className="max-w-[180px] truncate">{workspacePath}</span>
|
|
104
105
|
<span className="icon-[mdi--chevron-down] h-3.5 w-3.5 shrink-0 text-muted-foreground" />
|
|
105
|
-
</
|
|
106
|
+
</Button>
|
|
106
107
|
<button
|
|
107
108
|
type="button"
|
|
108
109
|
onClick={onResetWorkspace}
|
|
@@ -117,7 +118,6 @@ export function GeneralSettingsView({
|
|
|
117
118
|
<MotionSelect
|
|
118
119
|
value={executionMode}
|
|
119
120
|
onValueChange={onExecutionModeChange}
|
|
120
|
-
triggerClassName="min-w-[120px]"
|
|
121
121
|
options={[
|
|
122
122
|
{ value: "full-access", label: labels.fullAccess },
|
|
123
123
|
{
|
|
@@ -129,15 +129,12 @@ export function GeneralSettingsView({
|
|
|
129
129
|
]}
|
|
130
130
|
/>
|
|
131
131
|
</SettingRow>
|
|
132
|
-
<SettingRow
|
|
133
|
-
title={labels.systemNotifications}
|
|
134
|
-
description={labels.systemNotificationsDescription}
|
|
135
|
-
border={false}
|
|
136
|
-
>
|
|
137
|
-
<Switch checked={notificationsEnabled} onCheckedChange={onNotificationsChange} />
|
|
138
|
-
</SettingRow>
|
|
139
132
|
</SettingSection>
|
|
140
133
|
|
|
134
|
+
<NotificationSettingsView {...notifications} section={sections.notifications} />
|
|
135
|
+
|
|
136
|
+
{networkSection}
|
|
137
|
+
|
|
141
138
|
<SettingSection title={labels.sections.app} section={sections.app}>
|
|
142
139
|
{/* 与下方 App 引导同一 SettingRow:左标题+描述,右 outline sm 按钮。 */}
|
|
143
140
|
<SettingRow
|
|
@@ -149,7 +146,7 @@ export function GeneralSettingsView({
|
|
|
149
146
|
</SettingRow>
|
|
150
147
|
{updatesDetail ? <div className="border-b border-border px-5 pb-4">{updatesDetail}</div> : null}
|
|
151
148
|
<SettingRow title={labels.startAppGuide} description={labels.startAppGuideDescription} border={false}>
|
|
152
|
-
<Button
|
|
149
|
+
<Button variant="field" onClick={onStartAppGuide}>
|
|
153
150
|
{labels.startAppGuideAction}
|
|
154
151
|
</Button>
|
|
155
152
|
</SettingRow>
|
|
@@ -164,7 +161,7 @@ export function GeneralSettingsView({
|
|
|
164
161
|
description={labels.exportDiagnosticsDescription}
|
|
165
162
|
border={false}
|
|
166
163
|
>
|
|
167
|
-
<Button
|
|
164
|
+
<Button variant="field" disabled={exportingDiagnostics} onClick={onExportDiagnostics}>
|
|
168
165
|
{exportingDiagnostics ? labels.exporting : labels.export}
|
|
169
166
|
</Button>
|
|
170
167
|
</SettingRow>
|
|
@@ -49,7 +49,7 @@ export function ImChannelGuideDialogView({
|
|
|
49
49
|
{/* 弹窗本体固定高度、不滚动:滚动条只出现在下面的内容区,
|
|
50
50
|
页头与页脚始终可见;overflow-x-hidden 杜绝横向滚动条。 */}
|
|
51
51
|
<DialogContent className="flex max-h-[min(90vh,760px)] flex-col gap-0 overflow-hidden p-0 sm:max-w-[560px]">
|
|
52
|
-
<DialogHeader className="shrink-0 gap-3
|
|
52
|
+
<DialogHeader className="shrink-0 gap-3 px-6 pt-6 pb-5">
|
|
53
53
|
<div className="flex items-start gap-3.5">
|
|
54
54
|
<div className="flex h-11 w-11 shrink-0 items-center justify-center rounded-2xl bg-primary/10 text-primary ring-1 ring-primary/15 ring-inset">
|
|
55
55
|
<span className="icon-[mdi--book-open-page-variant-outline] h-5 w-5" />
|
|
@@ -115,7 +115,7 @@ export function ImChannelGuideDialogView({
|
|
|
115
115
|
))}
|
|
116
116
|
</div>
|
|
117
117
|
|
|
118
|
-
<DialogFooter className="
|
|
118
|
+
<DialogFooter className="mx-0 mb-0 shrink-0 px-6 py-4">
|
|
119
119
|
<Button variant="primary" onClick={onClose}>
|
|
120
120
|
{labels.close}
|
|
121
121
|
</Button>
|
|
@@ -142,7 +142,7 @@ export function ImFeishuDialogView({
|
|
|
142
142
|
{/* 动作按钮成组,justify-between 才是「说明 | 动作」两端分布,
|
|
143
143
|
而不是把每个按钮都摊开。 */}
|
|
144
144
|
<div className="flex items-center gap-2">
|
|
145
|
-
<Button variant="
|
|
145
|
+
<Button variant="field" onClick={onTest} disabled={testing || !canTest}>
|
|
146
146
|
{testing ? labels.testing : labels.testConnection}
|
|
147
147
|
</Button>
|
|
148
148
|
<Button variant="primary" onClick={onSave} disabled={!canSave || saving}>
|
|
@@ -35,7 +35,7 @@ export function ImLegacyImportBannerView({
|
|
|
35
35
|
<Button variant="primary" size="sm" onClick={onImport} disabled={importDisabled}>
|
|
36
36
|
{importLabel}
|
|
37
37
|
</Button>
|
|
38
|
-
<Button variant="
|
|
38
|
+
<Button variant="field" onClick={onSkip}>
|
|
39
39
|
{skipLabel}
|
|
40
40
|
</Button>
|
|
41
41
|
</div>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { JSX } from "react";
|
|
2
2
|
import { Button, cn } from "@vetta-org/ui";
|
|
3
3
|
import { SettingHeading, type SettingSectionMeta } from "./SettingChrome";
|
|
4
|
+
import { OVERLAY_BACKDROP_CLASS } from "@vetta-org/ui/utils";
|
|
4
5
|
|
|
5
6
|
export interface ImLogEventView {
|
|
6
7
|
readonly time: string;
|
|
@@ -37,7 +38,7 @@ export function ImLogDrawerView({
|
|
|
37
38
|
labels,
|
|
38
39
|
}: ImLogDrawerViewProps): JSX.Element {
|
|
39
40
|
return (
|
|
40
|
-
<div className="fixed inset-0 z-50 flex justify-end
|
|
41
|
+
<div className={cn("fixed inset-0 z-50 flex justify-end", OVERLAY_BACKDROP_CLASS)} onClick={onClose}>
|
|
41
42
|
<div
|
|
42
43
|
className="flex h-full w-[520px] flex-col border-l border-border bg-background shadow-xl"
|
|
43
44
|
onClick={(event) => event.stopPropagation()}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import { json } from "@codemirror/lang-json";
|
|
2
|
+
import { HighlightStyle, syntaxHighlighting } from "@codemirror/language";
|
|
3
|
+
import { Compartment, EditorState } from "@codemirror/state";
|
|
4
|
+
import { EditorView, placeholder as editorPlaceholder } from "@codemirror/view";
|
|
5
|
+
import { tags } from "@lezer/highlight";
|
|
6
|
+
import { minimalSetup } from "codemirror";
|
|
7
|
+
import { useEffect, useRef, type JSX } from "react";
|
|
8
|
+
|
|
9
|
+
const jsonConfigHighlightStyle = HighlightStyle.define([
|
|
10
|
+
{
|
|
11
|
+
tag: [tags.propertyName, tags.definition(tags.propertyName)],
|
|
12
|
+
color: "var(--foreground)",
|
|
13
|
+
fontWeight: "500",
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
tag: [tags.string, tags.number, tags.bool, tags.null],
|
|
17
|
+
color: "color-mix(in srgb, var(--foreground) 82%, var(--primary))",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
tag: [tags.punctuation, tags.brace, tags.squareBracket, tags.separator],
|
|
21
|
+
color: "color-mix(in srgb, var(--muted-foreground) 78%, transparent)",
|
|
22
|
+
},
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
const jsonConfigInputTheme = EditorView.theme({
|
|
26
|
+
"&": {
|
|
27
|
+
height: "100%",
|
|
28
|
+
color: "var(--foreground)",
|
|
29
|
+
backgroundColor: "transparent",
|
|
30
|
+
fontSize: "13px",
|
|
31
|
+
},
|
|
32
|
+
"&.cm-focused": {
|
|
33
|
+
outline: "none",
|
|
34
|
+
},
|
|
35
|
+
".cm-scroller": {
|
|
36
|
+
overflow: "auto",
|
|
37
|
+
overscrollBehavior: "contain",
|
|
38
|
+
fontFamily: "var(--font-sans)",
|
|
39
|
+
lineHeight: "1.55",
|
|
40
|
+
},
|
|
41
|
+
".cm-content": {
|
|
42
|
+
minHeight: "100%",
|
|
43
|
+
padding: "10px 12px",
|
|
44
|
+
caretColor: "var(--primary)",
|
|
45
|
+
},
|
|
46
|
+
".cm-line": {
|
|
47
|
+
padding: "0",
|
|
48
|
+
},
|
|
49
|
+
".cm-placeholder": {
|
|
50
|
+
color: "color-mix(in srgb, var(--muted-foreground) 40%, transparent)",
|
|
51
|
+
fontStyle: "normal",
|
|
52
|
+
},
|
|
53
|
+
".cm-selectionBackground, &.cm-focused .cm-selectionBackground": {
|
|
54
|
+
backgroundColor: "color-mix(in srgb, var(--primary) 15%, transparent) !important",
|
|
55
|
+
},
|
|
56
|
+
".cm-cursor, .cm-dropCursor": {
|
|
57
|
+
borderLeftColor: "var(--primary)",
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export interface JsonConfigInputViewProps {
|
|
62
|
+
readonly value: string;
|
|
63
|
+
readonly onValueChange: (value: string) => void;
|
|
64
|
+
readonly placeholder: string;
|
|
65
|
+
readonly ariaLabel: string;
|
|
66
|
+
readonly ariaInvalid?: boolean;
|
|
67
|
+
readonly ariaDescribedBy?: string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/** A restrained, theme-aware JSON field without IDE chrome or editor-only tools. */
|
|
71
|
+
export function JsonConfigInputView({
|
|
72
|
+
value,
|
|
73
|
+
onValueChange,
|
|
74
|
+
placeholder,
|
|
75
|
+
ariaLabel,
|
|
76
|
+
ariaInvalid = false,
|
|
77
|
+
ariaDescribedBy,
|
|
78
|
+
}: JsonConfigInputViewProps): JSX.Element {
|
|
79
|
+
const hostRef = useRef<HTMLDivElement>(null);
|
|
80
|
+
const viewRef = useRef<EditorView | null>(null);
|
|
81
|
+
const onValueChangeRef = useRef(onValueChange);
|
|
82
|
+
const applyingExternalValueRef = useRef(false);
|
|
83
|
+
const initialValueRef = useRef(value);
|
|
84
|
+
const initialPlaceholderRef = useRef(placeholder);
|
|
85
|
+
const initialAccessibilityRef = useRef({ ariaLabel, ariaInvalid, ariaDescribedBy });
|
|
86
|
+
const accessibilityCompartmentRef = useRef(new Compartment());
|
|
87
|
+
const placeholderCompartmentRef = useRef(new Compartment());
|
|
88
|
+
onValueChangeRef.current = onValueChange;
|
|
89
|
+
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
const host = hostRef.current;
|
|
92
|
+
if (!host) return;
|
|
93
|
+
|
|
94
|
+
const initialAccessibility = initialAccessibilityRef.current;
|
|
95
|
+
const accessibilityAttributes: Record<string, string> = {
|
|
96
|
+
"aria-label": initialAccessibility.ariaLabel,
|
|
97
|
+
"aria-invalid": String(initialAccessibility.ariaInvalid),
|
|
98
|
+
spellcheck: "false",
|
|
99
|
+
autocapitalize: "off",
|
|
100
|
+
autocomplete: "off",
|
|
101
|
+
};
|
|
102
|
+
if (initialAccessibility.ariaDescribedBy) {
|
|
103
|
+
accessibilityAttributes["aria-describedby"] = initialAccessibility.ariaDescribedBy;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const state = EditorState.create({
|
|
107
|
+
doc: initialValueRef.current,
|
|
108
|
+
extensions: [
|
|
109
|
+
minimalSetup,
|
|
110
|
+
json(),
|
|
111
|
+
EditorView.lineWrapping,
|
|
112
|
+
jsonConfigInputTheme,
|
|
113
|
+
syntaxHighlighting(jsonConfigHighlightStyle),
|
|
114
|
+
accessibilityCompartmentRef.current.of(EditorView.contentAttributes.of(accessibilityAttributes)),
|
|
115
|
+
placeholderCompartmentRef.current.of(editorPlaceholder(initialPlaceholderRef.current)),
|
|
116
|
+
EditorView.updateListener.of((update) => {
|
|
117
|
+
if (update.docChanged && !applyingExternalValueRef.current) {
|
|
118
|
+
onValueChangeRef.current(update.state.doc.toString());
|
|
119
|
+
}
|
|
120
|
+
}),
|
|
121
|
+
],
|
|
122
|
+
});
|
|
123
|
+
const view = new EditorView({ state, parent: host });
|
|
124
|
+
viewRef.current = view;
|
|
125
|
+
|
|
126
|
+
return () => {
|
|
127
|
+
view.destroy();
|
|
128
|
+
viewRef.current = null;
|
|
129
|
+
};
|
|
130
|
+
}, []);
|
|
131
|
+
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
const view = viewRef.current;
|
|
134
|
+
if (!view) return;
|
|
135
|
+
const currentValue = view.state.doc.toString();
|
|
136
|
+
if (currentValue === value) return;
|
|
137
|
+
applyingExternalValueRef.current = true;
|
|
138
|
+
try {
|
|
139
|
+
view.dispatch({ changes: { from: 0, to: currentValue.length, insert: value } });
|
|
140
|
+
} finally {
|
|
141
|
+
applyingExternalValueRef.current = false;
|
|
142
|
+
}
|
|
143
|
+
}, [value]);
|
|
144
|
+
|
|
145
|
+
useEffect(() => {
|
|
146
|
+
const view = viewRef.current;
|
|
147
|
+
if (!view) return;
|
|
148
|
+
const accessibilityAttributes: Record<string, string> = {
|
|
149
|
+
"aria-label": ariaLabel,
|
|
150
|
+
"aria-invalid": String(ariaInvalid),
|
|
151
|
+
spellcheck: "false",
|
|
152
|
+
autocapitalize: "off",
|
|
153
|
+
autocomplete: "off",
|
|
154
|
+
};
|
|
155
|
+
if (ariaDescribedBy) accessibilityAttributes["aria-describedby"] = ariaDescribedBy;
|
|
156
|
+
view.dispatch({
|
|
157
|
+
effects: [
|
|
158
|
+
accessibilityCompartmentRef.current.reconfigure(EditorView.contentAttributes.of(accessibilityAttributes)),
|
|
159
|
+
placeholderCompartmentRef.current.reconfigure(editorPlaceholder(placeholder)),
|
|
160
|
+
],
|
|
161
|
+
});
|
|
162
|
+
}, [ariaDescribedBy, ariaInvalid, ariaLabel, placeholder]);
|
|
163
|
+
|
|
164
|
+
return (
|
|
165
|
+
<div
|
|
166
|
+
ref={hostRef}
|
|
167
|
+
data-invalid={ariaInvalid ? "true" : "false"}
|
|
168
|
+
className="h-72 min-h-40 w-full resize-y overflow-hidden rounded-lg border border-input bg-card text-foreground transition-colors focus-within:border-ring data-[invalid=true]:border-destructive"
|
|
169
|
+
/>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import type { JSX } from "react";
|
|
2
|
+
import { Button, Input, cn } from "@vetta-org/ui";
|
|
3
|
+
|
|
4
|
+
/** 单个候选模型的连通性测试结果。 */
|
|
5
|
+
export interface FetchedModelTestView {
|
|
6
|
+
readonly status: "testing" | "ok" | "fail";
|
|
7
|
+
readonly message?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** 候选模型行:接口返回的参数与勾选、测试状态都在这里。 */
|
|
11
|
+
export interface FetchedModelRowView {
|
|
12
|
+
readonly id: string;
|
|
13
|
+
readonly name?: string;
|
|
14
|
+
readonly ownedBy?: string;
|
|
15
|
+
readonly contextWindow?: number;
|
|
16
|
+
readonly maxTokens?: number;
|
|
17
|
+
readonly vision?: boolean;
|
|
18
|
+
readonly reasoning?: boolean;
|
|
19
|
+
/** 上游声明的思考档位,跟在「思考」标记后面。 */
|
|
20
|
+
readonly reasoningLevels?: readonly string[];
|
|
21
|
+
readonly selected: boolean;
|
|
22
|
+
readonly alreadyAdded: boolean;
|
|
23
|
+
readonly test?: FetchedModelTestView;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ModelsFetchedModelsDrawerViewLabels {
|
|
27
|
+
readonly title: string;
|
|
28
|
+
/** 标题下的 provider 行。 */
|
|
29
|
+
readonly subtitle: string;
|
|
30
|
+
/** 已拉取到的候选数量说明;未就绪时为空串。 */
|
|
31
|
+
readonly hint: string;
|
|
32
|
+
readonly searchPlaceholder: string;
|
|
33
|
+
readonly clearSearch: string;
|
|
34
|
+
readonly listLabel: string;
|
|
35
|
+
readonly emptyList: string;
|
|
36
|
+
readonly emptySearch: string;
|
|
37
|
+
readonly selectAll: string;
|
|
38
|
+
readonly deselectAll: string;
|
|
39
|
+
readonly selectedCount: string;
|
|
40
|
+
readonly alreadyAdded: string;
|
|
41
|
+
readonly vision: string;
|
|
42
|
+
readonly thinking: string;
|
|
43
|
+
readonly testAction: string;
|
|
44
|
+
readonly testing: string;
|
|
45
|
+
readonly testOk: string;
|
|
46
|
+
readonly testFail: string;
|
|
47
|
+
readonly apply: string;
|
|
48
|
+
readonly cancel: string;
|
|
49
|
+
readonly retry: string;
|
|
50
|
+
readonly loading: string;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ModelsFetchedModelsDrawerViewProps {
|
|
54
|
+
readonly labels: ModelsFetchedModelsDrawerViewLabels;
|
|
55
|
+
readonly status: "loading" | "ready" | "error";
|
|
56
|
+
readonly error?: string;
|
|
57
|
+
/** 当前可见的行(已按搜索词筛过)。 */
|
|
58
|
+
readonly rows: readonly FetchedModelRowView[];
|
|
59
|
+
/** 接口返回的候选总数,用于区分「没有模型」和「没有匹配」。 */
|
|
60
|
+
readonly totalCount: number;
|
|
61
|
+
readonly selectedCount: number;
|
|
62
|
+
readonly searchQuery: string;
|
|
63
|
+
readonly saving: boolean;
|
|
64
|
+
readonly onSearchQueryChange: (value: string) => void;
|
|
65
|
+
readonly onToggle: (modelId: string) => void;
|
|
66
|
+
readonly onSelectAll: () => void;
|
|
67
|
+
readonly onDeselectAll: () => void;
|
|
68
|
+
readonly onTest: (modelId: string) => void;
|
|
69
|
+
readonly onRetry: () => void;
|
|
70
|
+
readonly onApply: () => void;
|
|
71
|
+
readonly onClose: () => void;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 「从接口拉取模型」抽屉的展示层:服务商行右侧滑出,列出 `GET {baseUrl}/models`
|
|
76
|
+
* 返回的全部候选模型及其参数,勾选后批量写入。
|
|
77
|
+
*
|
|
78
|
+
* 全选/全不选只作用于 `rows`(当前可见项)——搜索后用户看到什么就选什么,
|
|
79
|
+
* 被筛掉的勾选状态保留在连接层的 `selected` 里。
|
|
80
|
+
*/
|
|
81
|
+
export function ModelsFetchedModelsDrawerView({
|
|
82
|
+
labels,
|
|
83
|
+
status,
|
|
84
|
+
error,
|
|
85
|
+
rows,
|
|
86
|
+
totalCount,
|
|
87
|
+
selectedCount,
|
|
88
|
+
searchQuery,
|
|
89
|
+
saving,
|
|
90
|
+
onSearchQueryChange,
|
|
91
|
+
onToggle,
|
|
92
|
+
onSelectAll,
|
|
93
|
+
onDeselectAll,
|
|
94
|
+
onTest,
|
|
95
|
+
onRetry,
|
|
96
|
+
onApply,
|
|
97
|
+
onClose,
|
|
98
|
+
}: ModelsFetchedModelsDrawerViewProps): JSX.Element {
|
|
99
|
+
const selectableRows = rows.filter((row) => !row.alreadyAdded);
|
|
100
|
+
const canSelectAll = selectableRows.some((row) => !row.selected);
|
|
101
|
+
const canDeselectAll = rows.some((row) => row.selected);
|
|
102
|
+
|
|
103
|
+
return (
|
|
104
|
+
<div className="flex h-full flex-col">
|
|
105
|
+
<header className="border-b border-border px-5 py-4">
|
|
106
|
+
<h2 className="truncate text-[15px] font-semibold text-foreground">{labels.title}</h2>
|
|
107
|
+
<p className="mt-0.5 truncate text-[11px] text-muted-foreground/70">{labels.subtitle}</p>
|
|
108
|
+
</header>
|
|
109
|
+
|
|
110
|
+
{status === "loading" ? (
|
|
111
|
+
<div className="flex flex-1 items-center justify-center gap-2 text-muted-foreground">
|
|
112
|
+
<span className="icon-[solar--refresh-linear] h-5 w-5 animate-spin" />
|
|
113
|
+
<span className="text-[12px]">{labels.loading}</span>
|
|
114
|
+
</div>
|
|
115
|
+
) : status === "error" ? (
|
|
116
|
+
<div className="flex flex-1 flex-col items-center justify-center gap-3 px-8 text-center">
|
|
117
|
+
<span className="icon-[solar--danger-triangle-linear] h-8 w-8 text-destructive" />
|
|
118
|
+
<p className="text-[12px] text-destructive">{error}</p>
|
|
119
|
+
<Button variant="field" onClick={onRetry}>
|
|
120
|
+
{labels.retry}
|
|
121
|
+
</Button>
|
|
122
|
+
</div>
|
|
123
|
+
) : (
|
|
124
|
+
<>
|
|
125
|
+
<div className="flex items-center gap-2 border-b border-border/50 px-5 py-2.5">
|
|
126
|
+
<div className="relative min-w-0 flex-1">
|
|
127
|
+
<span
|
|
128
|
+
aria-hidden="true"
|
|
129
|
+
className="icon-[solar--magnifer-linear] pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground/60"
|
|
130
|
+
/>
|
|
131
|
+
<Input
|
|
132
|
+
type="search"
|
|
133
|
+
value={searchQuery}
|
|
134
|
+
onChange={(event) => onSearchQueryChange(event.target.value)}
|
|
135
|
+
placeholder={labels.searchPlaceholder}
|
|
136
|
+
aria-label={labels.searchPlaceholder}
|
|
137
|
+
className="h-8 pl-8 pr-8 text-[12px]"
|
|
138
|
+
/>
|
|
139
|
+
{searchQuery && (
|
|
140
|
+
<button
|
|
141
|
+
type="button"
|
|
142
|
+
onClick={() => onSearchQueryChange("")}
|
|
143
|
+
aria-label={labels.clearSearch}
|
|
144
|
+
className="absolute right-1.5 top-1/2 inline-flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent hover:text-foreground"
|
|
145
|
+
>
|
|
146
|
+
<span aria-hidden="true" className="icon-[solar--close-circle-linear] h-3.5 w-3.5" />
|
|
147
|
+
</button>
|
|
148
|
+
)}
|
|
149
|
+
</div>
|
|
150
|
+
<Button variant="ghost" size="xs" onClick={onSelectAll} disabled={!canSelectAll}>
|
|
151
|
+
{labels.selectAll}
|
|
152
|
+
</Button>
|
|
153
|
+
<Button variant="ghost" size="xs" onClick={onDeselectAll} disabled={!canDeselectAll}>
|
|
154
|
+
{labels.deselectAll}
|
|
155
|
+
</Button>
|
|
156
|
+
</div>
|
|
157
|
+
|
|
158
|
+
<div className="flex items-center justify-between gap-3 px-5 py-2 text-[11px] text-muted-foreground">
|
|
159
|
+
<span className="min-w-0 truncate">{labels.hint}</span>
|
|
160
|
+
<span className="shrink-0">{labels.selectedCount}</span>
|
|
161
|
+
</div>
|
|
162
|
+
|
|
163
|
+
<div
|
|
164
|
+
role="region"
|
|
165
|
+
aria-label={labels.listLabel}
|
|
166
|
+
tabIndex={0}
|
|
167
|
+
className="min-h-0 flex-1 overflow-y-auto overscroll-contain border-t border-border/50 outline-none focus-visible:ring-1 focus-visible:ring-ring/60"
|
|
168
|
+
>
|
|
169
|
+
{rows.length === 0 && (
|
|
170
|
+
<div className="px-5 py-6 text-center text-[12px] text-muted-foreground">
|
|
171
|
+
{totalCount > 0 ? labels.emptySearch : labels.emptyList}
|
|
172
|
+
</div>
|
|
173
|
+
)}
|
|
174
|
+
{rows.map((row) => (
|
|
175
|
+
<FetchedModelRow key={row.id} row={row} labels={labels} onToggle={onToggle} onTest={onTest} />
|
|
176
|
+
))}
|
|
177
|
+
</div>
|
|
178
|
+
|
|
179
|
+
<footer className="flex items-center justify-end gap-2 border-t border-border px-5 py-3">
|
|
180
|
+
<Button size="sm" onClick={onApply} disabled={saving || selectedCount === 0}>
|
|
181
|
+
{labels.apply}
|
|
182
|
+
</Button>
|
|
183
|
+
<Button variant="ghost" size="sm" onClick={onClose}>
|
|
184
|
+
{labels.cancel}
|
|
185
|
+
</Button>
|
|
186
|
+
</footer>
|
|
187
|
+
</>
|
|
188
|
+
)}
|
|
189
|
+
</div>
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function FetchedModelRow({
|
|
194
|
+
row,
|
|
195
|
+
labels,
|
|
196
|
+
onToggle,
|
|
197
|
+
onTest,
|
|
198
|
+
}: {
|
|
199
|
+
readonly row: FetchedModelRowView;
|
|
200
|
+
readonly labels: ModelsFetchedModelsDrawerViewLabels;
|
|
201
|
+
readonly onToggle: (modelId: string) => void;
|
|
202
|
+
readonly onTest: (modelId: string) => void;
|
|
203
|
+
}): JSX.Element {
|
|
204
|
+
const subtitle = [row.name, row.ownedBy].filter(Boolean).join(" · ");
|
|
205
|
+
|
|
206
|
+
return (
|
|
207
|
+
<div className="flex items-center gap-3 border-b border-border/50 px-5 py-2.5 last:border-b-0 hover:bg-accent/40">
|
|
208
|
+
<button
|
|
209
|
+
type="button"
|
|
210
|
+
aria-pressed={row.selected}
|
|
211
|
+
onClick={() => onToggle(row.id)}
|
|
212
|
+
className="flex min-w-0 flex-1 items-center gap-2.5 text-left"
|
|
213
|
+
>
|
|
214
|
+
<span
|
|
215
|
+
aria-hidden="true"
|
|
216
|
+
className={cn(
|
|
217
|
+
"h-3.5 w-3.5 shrink-0",
|
|
218
|
+
row.selected ? "icon-[mdi--checkbox-marked] text-primary" : "icon-[mdi--checkbox-blank-outline] text-muted-foreground",
|
|
219
|
+
)}
|
|
220
|
+
/>
|
|
221
|
+
<span className="min-w-0 flex-1">
|
|
222
|
+
<span className="flex items-center gap-2">
|
|
223
|
+
<span className="truncate text-[12px] font-medium text-foreground">{row.id}</span>
|
|
224
|
+
{row.alreadyAdded && (
|
|
225
|
+
<span className="shrink-0 rounded-full bg-muted px-1.5 py-0.5 text-[9px] text-muted-foreground">
|
|
226
|
+
{labels.alreadyAdded}
|
|
227
|
+
</span>
|
|
228
|
+
)}
|
|
229
|
+
</span>
|
|
230
|
+
{subtitle && <span className="mt-0.5 block truncate text-[10px] text-muted-foreground/70">{subtitle}</span>}
|
|
231
|
+
</span>
|
|
232
|
+
</button>
|
|
233
|
+
|
|
234
|
+
<span className="flex shrink-0 items-center gap-2 text-[10px] text-muted-foreground">
|
|
235
|
+
{row.contextWindow != null && <span>{(row.contextWindow / 1024).toFixed(0)}K ctx</span>}
|
|
236
|
+
{row.maxTokens != null && <span>{(row.maxTokens / 1024).toFixed(0)}K max</span>}
|
|
237
|
+
{row.vision && (
|
|
238
|
+
<span className="rounded bg-primary/10 px-1 py-0.5 text-[9px] text-primary">{labels.vision}</span>
|
|
239
|
+
)}
|
|
240
|
+
{row.reasoning && (
|
|
241
|
+
<span className="rounded bg-accent px-1 py-0.5 text-[9px] text-muted-foreground">
|
|
242
|
+
{labels.thinking}
|
|
243
|
+
{row.reasoningLevels?.length ? ` · ${row.reasoningLevels.join("/")}` : ""}
|
|
244
|
+
</span>
|
|
245
|
+
)}
|
|
246
|
+
</span>
|
|
247
|
+
|
|
248
|
+
<FetchedModelTestControl row={row} labels={labels} onTest={onTest} />
|
|
249
|
+
</div>
|
|
250
|
+
);
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function FetchedModelTestControl({
|
|
254
|
+
row,
|
|
255
|
+
labels,
|
|
256
|
+
onTest,
|
|
257
|
+
}: {
|
|
258
|
+
readonly row: FetchedModelRowView;
|
|
259
|
+
readonly labels: ModelsFetchedModelsDrawerViewLabels;
|
|
260
|
+
readonly onTest: (modelId: string) => void;
|
|
261
|
+
}): JSX.Element {
|
|
262
|
+
const test = row.test;
|
|
263
|
+
if (test?.status === "testing") {
|
|
264
|
+
return (
|
|
265
|
+
<Button variant="ghost" size="xs" disabled className="shrink-0">
|
|
266
|
+
<span className="icon-[solar--refresh-linear] h-3 w-3 animate-spin" />
|
|
267
|
+
{labels.testing}
|
|
268
|
+
</Button>
|
|
269
|
+
);
|
|
270
|
+
}
|
|
271
|
+
if (test?.status === "ok" || test?.status === "fail") {
|
|
272
|
+
const ok = test.status === "ok";
|
|
273
|
+
return (
|
|
274
|
+
<Button
|
|
275
|
+
variant="ghost"
|
|
276
|
+
size="xs"
|
|
277
|
+
onClick={() => onTest(row.id)}
|
|
278
|
+
title={test.message}
|
|
279
|
+
className={cn("shrink-0", ok ? "text-emerald-400" : "text-destructive")}
|
|
280
|
+
>
|
|
281
|
+
<span className={cn("h-3 w-3", ok ? "icon-[solar--check-circle-linear]" : "icon-[solar--danger-triangle-linear]")} />
|
|
282
|
+
{ok ? labels.testOk : labels.testFail}
|
|
283
|
+
</Button>
|
|
284
|
+
);
|
|
285
|
+
}
|
|
286
|
+
return (
|
|
287
|
+
<Button variant="ghost" size="xs" onClick={() => onTest(row.id)} title={labels.testAction} className="shrink-0">
|
|
288
|
+
<span className="icon-[solar--plug-circle-linear] h-3 w-3" />
|
|
289
|
+
{labels.testAction}
|
|
290
|
+
</Button>
|
|
291
|
+
);
|
|
292
|
+
}
|