@vibe-forge/client 0.3.0 → 0.5.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/cli.cjs +2 -1
- package/dist/assets/{arc-CwMXUVsq.js → arc-C4ymrcSQ.js} +1 -1
- package/dist/assets/{blockDiagram-c4efeb88-CGxJV7KJ.js → blockDiagram-c4efeb88-CeB7-kgP.js} +1 -1
- package/dist/assets/{c4Diagram-c83219d4-BKhin7cY.js → c4Diagram-c83219d4-C935Im8S.js} +1 -1
- package/dist/assets/channel-84s1ACzD.js +1 -0
- package/dist/assets/{classDiagram-beda092f-BASmn22R.js → classDiagram-beda092f-B9IV13KI.js} +1 -1
- package/dist/assets/{classDiagram-v2-2358418a-BUk9rNBX.js → classDiagram-v2-2358418a-CXF_K4fE.js} +1 -1
- package/dist/assets/clone-B2E8tddE.js +1 -0
- package/dist/assets/{createText-1719965b-2XqnWjQY.js → createText-1719965b-DwX8iC5F.js} +1 -1
- package/dist/assets/devicon-BWlTeAUU.woff +0 -0
- package/dist/assets/devicon-CirD-cQx.ttf +0 -0
- package/dist/assets/devicon-Dg8iWy0i.svg +1211 -0
- package/dist/assets/devicon-TqfHp33-.eot +0 -0
- package/dist/assets/{edges-96097737-B7e32Jeg.js → edges-96097737-9P1uH1RE.js} +1 -1
- package/dist/assets/{erDiagram-0228fc6a-CCR2or72.js → erDiagram-0228fc6a-ixeGTFvg.js} +1 -1
- package/dist/assets/{flowDb-c6c81e3f-B72HWT9x.js → flowDb-c6c81e3f-G1gSTTBI.js} +1 -1
- package/dist/assets/{flowDiagram-50d868cf-WOi0KARY.js → flowDiagram-50d868cf-CzrG99nD.js} +1 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-CJfJYbME.js +1 -0
- package/dist/assets/{flowchart-elk-definition-6af322e1-i_Yd0LCE.js → flowchart-elk-definition-6af322e1-sFCoysWa.js} +1 -1
- package/dist/assets/{ganttDiagram-a2739b55-CFH9zF14.js → ganttDiagram-a2739b55-Ccsk_Lru.js} +1 -1
- package/dist/assets/{gitGraphDiagram-82fe8481-DglKfMze.js → gitGraphDiagram-82fe8481-CwathJ6H.js} +1 -1
- package/dist/assets/{graph-BKbBNGPf.js → graph-DRCU-8Rz.js} +1 -1
- package/dist/assets/{index-5325376f-BK7F9nSl.js → index-5325376f-Bq-fg2i_.js} +1 -1
- package/dist/assets/index-CHMuZ5-1.css +1 -0
- package/dist/assets/index-cGZvDhhU.js +542 -0
- package/dist/assets/{infoDiagram-8eee0895-BLFL77_D.js → infoDiagram-8eee0895-JBcUkJ6T.js} +1 -1
- package/dist/assets/{journeyDiagram-c64418c1-CS9XctDL.js → journeyDiagram-c64418c1-DsdQU-R8.js} +1 -1
- package/dist/assets/{layout-By3JZZGt.js → layout-s0slG1OL.js} +1 -1
- package/dist/assets/{line-9GUsXbwv.js → line-CymFqgW6.js} +1 -1
- package/dist/assets/{linear-DzGV4E9N.js → linear-lDQVZ6aQ.js} +1 -1
- package/dist/assets/{mermaid.core-CG3Ib42Q.js → mermaid.core-Cmlqga_E.js} +6 -6
- package/dist/assets/{mindmap-definition-8da855dc-WQ3LPKJU.js → mindmap-definition-8da855dc-CqqTDJn_.js} +1 -1
- package/dist/assets/{pieDiagram-a8764435-DHVIUZiN.js → pieDiagram-a8764435-BL2Ajx7Z.js} +1 -1
- package/dist/assets/{quadrantDiagram-1e28029f-C3G9Ye8-.js → quadrantDiagram-1e28029f-ClL_3ASt.js} +1 -1
- package/dist/assets/{requirementDiagram-08caed73-C9ES1D5G.js → requirementDiagram-08caed73-CB1RgE3K.js} +1 -1
- package/dist/assets/{sankeyDiagram-a04cb91d-B4BKXclQ.js → sankeyDiagram-a04cb91d-tgleEYiD.js} +1 -1
- package/dist/assets/{sequenceDiagram-c5b8d532-DrgEb25G.js → sequenceDiagram-c5b8d532-DlatQT5R.js} +1 -1
- package/dist/assets/{stateDiagram-1ecb1508-CF1XWARJ.js → stateDiagram-1ecb1508-B--MLqRs.js} +1 -1
- package/dist/assets/{stateDiagram-v2-c2b004d7-IO3i3yXv.js → stateDiagram-v2-c2b004d7-CRMZ6Dpx.js} +1 -1
- package/dist/assets/{styles-b4e223ce-DACN9aSc.js → styles-b4e223ce-CPiYHfUz.js} +1 -1
- package/dist/assets/{styles-ca3715f6-bekm2WLP.js → styles-ca3715f6-B9UKPAzX.js} +1 -1
- package/dist/assets/{styles-d45a18b0-OzTDVBb8.js → styles-d45a18b0-BC1Ak1So.js} +1 -1
- package/dist/assets/{svgDrawCommon-b86b1483-BWroJerr.js → svgDrawCommon-b86b1483-DV8R0g-n.js} +1 -1
- package/dist/assets/{timeline-definition-faaaa080-CCfRNigO.js → timeline-definition-faaaa080-CiqGS5DC.js} +1 -1
- package/dist/assets/{xychartDiagram-f5964ef8-C3cbfVqN.js → xychartDiagram-f5964ef8-h6VSD3GE.js} +1 -1
- package/dist/index.html +2 -7
- package/index.html +0 -5
- package/package.json +12 -6
- package/src/App.tsx +2 -0
- package/src/api/README.md +26 -0
- package/src/api/automation.ts +88 -0
- package/src/api/base.ts +54 -0
- package/src/api/benchmark.ts +45 -0
- package/src/api/config.ts +24 -0
- package/src/api/knowledge.ts +72 -0
- package/src/api/projects.ts +15 -0
- package/src/api/sessions.ts +84 -0
- package/src/api/types.ts +20 -0
- package/src/api.ts +44 -269
- package/src/components/AutomationView/AutomationView.scss +5 -1
- package/src/components/AutomationView/RuleFormPanel.tsx +3 -2
- package/src/components/AutomationView/TaskList.scss +4 -6
- package/src/components/AutomationView/TaskList.tsx +2 -1
- package/src/components/AutomationView/TriggerList.scss +4 -1
- package/src/components/BenchmarkView/BenchmarkCasePanel.scss +267 -0
- package/src/components/BenchmarkView/BenchmarkCasePanel.tsx +309 -0
- package/src/components/BenchmarkView/BenchmarkSidebar.scss +182 -0
- package/src/components/BenchmarkView/BenchmarkSidebar.tsx +262 -0
- package/src/components/BenchmarkView/BenchmarkView.scss +78 -0
- package/src/components/BenchmarkView/index.tsx +197 -0
- package/src/components/BenchmarkView/types.ts +10 -0
- package/src/components/BenchmarkView/utils.ts +21 -0
- package/src/components/Chat.tsx +43 -29
- package/src/components/{chat/CodeBlock.tsx → CodeBlock.tsx} +3 -1
- package/src/components/ConfigView.tsx +32 -25
- package/src/components/{chat/MarkdownContent.tsx → MarkdownContent.tsx} +1 -1
- package/src/components/NavRail.tsx +7 -0
- package/src/components/chat/ChatHeader.scss +37 -19
- package/src/components/chat/ChatHeader.tsx +6 -9
- package/src/components/chat/ChatHistoryView.tsx +99 -45
- package/src/components/chat/CurrentTodoList.tsx +10 -9
- package/src/components/chat/{MessageItem.scss → Messages/MessageItem.scss} +14 -0
- package/src/components/chat/{MessageItem.tsx → Messages/MessageItem.tsx} +30 -8
- package/src/components/chat/{messageUtils.ts → Messages/message-utils.ts} +1 -1
- package/src/components/chat/{Sender.scss → Sender/Sender.scss} +146 -3
- package/src/components/chat/{Sender.tsx → Sender/Sender.tsx} +183 -5
- package/src/components/chat/tools/DefaultTool.tsx +184 -21
- package/src/components/chat/tools/adapter-claude/BashTool.scss +67 -51
- package/src/components/chat/tools/adapter-claude/BashTool.tsx +83 -49
- package/src/components/chat/tools/adapter-claude/GlobTool.scss +0 -79
- package/src/components/chat/tools/adapter-claude/GlobTool.tsx +16 -36
- package/src/components/chat/tools/adapter-claude/GrepTool.scss +0 -87
- package/src/components/chat/tools/adapter-claude/GrepTool.tsx +22 -41
- package/src/components/chat/tools/adapter-claude/LSTool.scss +0 -79
- package/src/components/chat/tools/adapter-claude/LSTool.tsx +15 -15
- package/src/components/chat/tools/adapter-claude/ReadTool.scss +0 -55
- package/src/components/chat/tools/adapter-claude/ReadTool.tsx +20 -42
- package/src/components/chat/tools/adapter-claude/TodoTool.scss +8 -23
- package/src/components/chat/tools/adapter-claude/TodoTool.tsx +24 -11
- package/src/components/chat/tools/adapter-claude/WriteTool.scss +21 -69
- package/src/components/chat/tools/adapter-claude/WriteTool.tsx +22 -58
- package/src/components/chat/tools/adapter-claude/index.ts +4 -10
- package/src/components/chat/tools/adapter-claude/utils.ts +54 -0
- package/src/components/chat/tools/core/ToolCallBox.scss +356 -0
- package/src/components/chat/{ToolGroup.tsx → tools/core/ToolGroup.tsx} +26 -7
- package/src/components/chat/{ToolRenderer.tsx → tools/core/ToolRenderer.tsx} +6 -4
- package/src/components/chat/tools/plugin-chrome-devtools/ChromeDevtoolsTool.scss +11 -0
- package/src/components/chat/tools/plugin-chrome-devtools/ChromeDevtoolsTool.tsx +75 -0
- package/src/components/chat/tools/plugin-chrome-devtools/index.ts +45 -0
- package/src/components/chat/tools/task/GetTaskInfoTool.scss +2 -27
- package/src/components/chat/tools/task/GetTaskInfoTool.tsx +48 -38
- package/src/components/chat/tools/task/ListTasksTool.scss +3 -28
- package/src/components/chat/tools/task/ListTasksTool.tsx +11 -8
- package/src/components/chat/tools/task/StartTasksTool.scss +3 -28
- package/src/components/chat/tools/task/StartTasksTool.tsx +14 -17
- package/src/components/chat/tools/task/components/TaskRow.scss +105 -0
- package/src/components/chat/tools/task/components/TaskRow.tsx +163 -0
- package/src/components/chat/tools/task/components/TaskToolCard.scss +15 -15
- package/src/components/chat/tools/task/components/TaskToolCard.tsx +8 -6
- package/src/components/config/ConfigSectionForm.tsx +12 -1
- package/src/components/config/ConfigSourceSwitch.tsx +12 -34
- package/src/components/config/channelDefinitions.ts +6 -0
- package/src/components/config/configSchema.ts +10 -1
- package/src/components/config/recordEditors/ChannelRecordEditor.scss +1 -0
- package/src/components/config/recordEditors/ChannelRecordEditor.tsx +397 -0
- package/src/components/config/recordEditors/index.tsx +1 -0
- package/src/components/knowledge-base/components/RuleItem.tsx +1 -1
- package/src/components/knowledge-base/components/SpecItem.tsx +1 -1
- package/src/components/sidebar/SessionItem.scss +17 -0
- package/src/components/sidebar/SessionItem.tsx +21 -13
- package/src/hooks/chat/use-chat-adapter.ts +81 -0
- package/src/hooks/chat/use-chat-interaction.ts +26 -0
- package/src/{components/chat/useChatModels.tsx → hooks/chat/use-chat-models.tsx} +117 -22
- package/src/hooks/chat/use-chat-permission-mode.ts +47 -0
- package/src/hooks/chat/use-chat-scroll.ts +51 -0
- package/src/hooks/chat/use-chat-session-actions.ts +153 -0
- package/src/hooks/chat/use-chat-session-messages.ts +262 -0
- package/src/hooks/chat/use-chat-session.ts +63 -0
- package/src/hooks/chat/use-chat-view.ts +39 -0
- package/src/main.tsx +10 -13
- package/src/resources/adapters.ts +20 -0
- package/src/resources/locales/en.json +66 -0
- package/src/resources/locales/zh.json +66 -0
- package/src/runtime-config.ts +52 -0
- package/src/vite-env.d.ts +11 -0
- package/src/ws.ts +5 -3
- package/vite.config.ts +12 -4
- package/dist/assets/channel-jbCEHqbG.js +0 -1
- package/dist/assets/clone-CCRKqS4L.js +0 -1
- package/dist/assets/flowDiagram-v2-4f6560a1-Baslbgn4.js +0 -1
- package/dist/assets/index-B0qfCb1G.css +0 -1
- package/dist/assets/index-CNo75dYr.js +0 -497
- package/src/components/chat/ToolCallBox.scss +0 -137
- package/src/components/chat/useChatSession.ts +0 -370
- /package/src/components/{chat/CodeBlock.scss → CodeBlock.scss} +0 -0
- /package/src/components/chat/{MessageFooter.tsx → Messages/MessageFooter.tsx} +0 -0
- /package/src/components/chat/{CompletionMenu.scss → Sender/CompletionMenu.scss} +0 -0
- /package/src/components/chat/{CompletionMenu.tsx → Sender/CompletionMenu.tsx} +0 -0
- /package/src/components/chat/{ThinkingStatus.scss → Sender/ThinkingStatus.scss} +0 -0
- /package/src/components/chat/{ThinkingStatus.tsx → Sender/ThinkingStatus.tsx} +0 -0
- /package/src/components/chat/{ToolCallBox.tsx → tools/core/ToolCallBox.tsx} +0 -0
- /package/src/components/chat/{ToolGroup.scss → tools/core/ToolGroup.scss} +0 -0
- /package/src/{components/chat/safeSerialize.ts → utils/safe-serialize.ts} +0 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import './BenchmarkView.scss'
|
|
2
|
+
|
|
3
|
+
import { App } from 'antd'
|
|
4
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react'
|
|
5
|
+
import { useTranslation } from 'react-i18next'
|
|
6
|
+
import useSWR from 'swr'
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
getBenchmarkResult,
|
|
10
|
+
getBenchmarkRun,
|
|
11
|
+
listBenchmarkCases,
|
|
12
|
+
listBenchmarkCategories,
|
|
13
|
+
startBenchmarkRun
|
|
14
|
+
} from '#~/api.js'
|
|
15
|
+
import { useQueryParams } from '#~/hooks/useQueryParams.js'
|
|
16
|
+
import type { BenchmarkCase } from '@vibe-forge/core'
|
|
17
|
+
|
|
18
|
+
import { BenchmarkCasePanel } from './BenchmarkCasePanel.js'
|
|
19
|
+
import { BenchmarkSidebar } from './BenchmarkSidebar.js'
|
|
20
|
+
import type { BenchmarkQueryParams } from './types.js'
|
|
21
|
+
import { isTerminalRun } from './utils.js'
|
|
22
|
+
|
|
23
|
+
export function BenchmarkView() {
|
|
24
|
+
const { t } = useTranslation()
|
|
25
|
+
const { message } = App.useApp()
|
|
26
|
+
|
|
27
|
+
// State
|
|
28
|
+
const [activeRunId, setActiveRunId] = useState('')
|
|
29
|
+
const [treeQuery, setTreeQuery] = useState('')
|
|
30
|
+
const [expandedKeys, setExpandedKeys] = useState<string[]>([])
|
|
31
|
+
const [checkedKeys, setCheckedKeys] = useState<string[]>([])
|
|
32
|
+
|
|
33
|
+
const { values, update } = useQueryParams<BenchmarkQueryParams>({
|
|
34
|
+
keys: ['category', 'title'],
|
|
35
|
+
defaults: { category: '', title: '' },
|
|
36
|
+
omit: {
|
|
37
|
+
category: (value: string) => value === '',
|
|
38
|
+
title: (value: string) => value === ''
|
|
39
|
+
}
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
// Data
|
|
43
|
+
const { data: categoriesData, mutate: mutateCategories } = useSWR(
|
|
44
|
+
'/api/benchmark/categories',
|
|
45
|
+
listBenchmarkCategories
|
|
46
|
+
)
|
|
47
|
+
const categories = categoriesData?.categories ?? []
|
|
48
|
+
|
|
49
|
+
const { data: casesData, mutate: mutateCases } = useSWR(
|
|
50
|
+
'/api/benchmark/cases',
|
|
51
|
+
() => listBenchmarkCases()
|
|
52
|
+
)
|
|
53
|
+
const cases = casesData?.cases ?? []
|
|
54
|
+
|
|
55
|
+
const selectedCase = useMemo<BenchmarkCase | null>(() => {
|
|
56
|
+
if (cases.length === 0) return null
|
|
57
|
+
const exact = cases.find(item => item.category === values.category && item.title === values.title)
|
|
58
|
+
if (exact) return exact
|
|
59
|
+
const sameCategoryFirst = values.category
|
|
60
|
+
? cases.find(item => item.category === values.category) ?? null
|
|
61
|
+
: null
|
|
62
|
+
return sameCategoryFirst ?? cases[0] ?? null
|
|
63
|
+
}, [cases, values.category, values.title])
|
|
64
|
+
|
|
65
|
+
const { data: resultData, mutate: mutateResult } = useSWR(
|
|
66
|
+
selectedCase ? `/api/benchmark/results/${selectedCase.category}/${selectedCase.title}` : null,
|
|
67
|
+
() => getBenchmarkResult(selectedCase?.category ?? '', selectedCase?.title ?? '')
|
|
68
|
+
)
|
|
69
|
+
const latestResult = resultData?.result ?? selectedCase?.latestResult ?? null
|
|
70
|
+
|
|
71
|
+
const { data: runData, mutate: mutateRun } = useSWR(
|
|
72
|
+
activeRunId ? `/api/benchmark/runs/${activeRunId}` : null,
|
|
73
|
+
() => getBenchmarkRun(activeRunId),
|
|
74
|
+
{ refreshInterval: activeRunId ? 2000 : 0 }
|
|
75
|
+
)
|
|
76
|
+
const activeRun = runData?.run
|
|
77
|
+
|
|
78
|
+
const progressPercent = useMemo(() => {
|
|
79
|
+
const totalCount = activeRun?.totalCount ?? 0
|
|
80
|
+
if (totalCount <= 0) return 0
|
|
81
|
+
const completedCount = activeRun?.completedCount ?? 0
|
|
82
|
+
return Math.min(100, Math.round((completedCount / totalCount) * 100))
|
|
83
|
+
}, [activeRun?.completedCount, activeRun?.totalCount])
|
|
84
|
+
|
|
85
|
+
// Handlers
|
|
86
|
+
const handleRunSpecificCase = useCallback(async (item: BenchmarkCase) => {
|
|
87
|
+
try {
|
|
88
|
+
const res = await startBenchmarkRun({ category: item.category, title: item.title })
|
|
89
|
+
setActiveRunId(res.run.runId)
|
|
90
|
+
void message.success(t('benchmark.runStarted'))
|
|
91
|
+
} catch {
|
|
92
|
+
void message.error(t('benchmark.runFailed'))
|
|
93
|
+
}
|
|
94
|
+
}, [message, t])
|
|
95
|
+
|
|
96
|
+
const handleRunCategory = useCallback(async (category: string) => {
|
|
97
|
+
try {
|
|
98
|
+
const res = await startBenchmarkRun({ category })
|
|
99
|
+
setActiveRunId(res.run.runId)
|
|
100
|
+
void message.success(t('benchmark.categoryRunStarted'))
|
|
101
|
+
} catch {
|
|
102
|
+
void message.error(t('benchmark.runFailed'))
|
|
103
|
+
}
|
|
104
|
+
}, [message, t])
|
|
105
|
+
|
|
106
|
+
const handleBatchRun = useCallback(async () => {
|
|
107
|
+
const caseKeys = checkedKeys.filter(k => k.startsWith('case:'))
|
|
108
|
+
const casesToRun = cases.filter(item => caseKeys.includes(`case:${item.category}/${item.title}`))
|
|
109
|
+
if (casesToRun.length === 0) {
|
|
110
|
+
for (const item of cases) {
|
|
111
|
+
try { await startBenchmarkRun({ category: item.category, title: item.title }) } catch { /* continue */ }
|
|
112
|
+
}
|
|
113
|
+
void message.success(t('benchmark.runStarted'))
|
|
114
|
+
return
|
|
115
|
+
}
|
|
116
|
+
let started = 0
|
|
117
|
+
for (const item of casesToRun) {
|
|
118
|
+
try {
|
|
119
|
+
await startBenchmarkRun({ category: item.category, title: item.title })
|
|
120
|
+
started++
|
|
121
|
+
} catch { /* continue */ }
|
|
122
|
+
}
|
|
123
|
+
if (started > 0) {
|
|
124
|
+
setCheckedKeys([])
|
|
125
|
+
void mutateCases()
|
|
126
|
+
void mutateCategories()
|
|
127
|
+
void message.success(t('benchmark.runStarted'))
|
|
128
|
+
}
|
|
129
|
+
}, [checkedKeys, cases, mutateCases, mutateCategories, message, t])
|
|
130
|
+
|
|
131
|
+
// Effects
|
|
132
|
+
useEffect(() => {
|
|
133
|
+
const nextKeys = categories.map(item => `category:${item.category}`)
|
|
134
|
+
setExpandedKeys((prev) => {
|
|
135
|
+
if (prev.length > 0 && treeQuery.trim() === '') return prev
|
|
136
|
+
return nextKeys
|
|
137
|
+
})
|
|
138
|
+
}, [categories, treeQuery])
|
|
139
|
+
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
if (selectedCase == null) return
|
|
142
|
+
if (values.category !== selectedCase.category || values.title !== selectedCase.title) {
|
|
143
|
+
update({ category: selectedCase.category, title: selectedCase.title })
|
|
144
|
+
}
|
|
145
|
+
}, [selectedCase, update, values.category, values.title])
|
|
146
|
+
|
|
147
|
+
useEffect(() => {
|
|
148
|
+
if (!isTerminalRun(activeRun)) return
|
|
149
|
+
void mutateCases()
|
|
150
|
+
void mutateCategories()
|
|
151
|
+
void mutateResult()
|
|
152
|
+
if (activeRunId !== '') void mutateRun()
|
|
153
|
+
const summary = activeRun?.status === 'completed'
|
|
154
|
+
? t('benchmark.runCompleted')
|
|
155
|
+
: t('benchmark.runFailed')
|
|
156
|
+
void message.info(summary)
|
|
157
|
+
setActiveRunId('')
|
|
158
|
+
}, [activeRun, activeRunId, message, mutateCases, mutateCategories, mutateResult, mutateRun, t])
|
|
159
|
+
|
|
160
|
+
const checkedCaseCount = checkedKeys.filter(k => k.startsWith('case:')).length
|
|
161
|
+
|
|
162
|
+
return (
|
|
163
|
+
<div className='benchmark-view'>
|
|
164
|
+
<div className='benchmark-view__left'>
|
|
165
|
+
<BenchmarkSidebar
|
|
166
|
+
cases={cases}
|
|
167
|
+
categories={categories}
|
|
168
|
+
selectedCase={selectedCase}
|
|
169
|
+
query={treeQuery}
|
|
170
|
+
expandedKeys={expandedKeys}
|
|
171
|
+
checkedKeys={checkedKeys}
|
|
172
|
+
checkedCaseCount={checkedCaseCount}
|
|
173
|
+
onQueryChange={setTreeQuery}
|
|
174
|
+
onExpandedKeysChange={setExpandedKeys}
|
|
175
|
+
onCheckedKeysChange={setCheckedKeys}
|
|
176
|
+
onSelectCase={(category, title) => update({ category, title })}
|
|
177
|
+
onRunCase={(item) => void handleRunSpecificCase(item)}
|
|
178
|
+
onRunCategory={(category) => void handleRunCategory(category)}
|
|
179
|
+
onBatchRun={() => void handleBatchRun()}
|
|
180
|
+
/>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<div className='benchmark-view__divider' />
|
|
184
|
+
|
|
185
|
+
<div className='benchmark-view__right'>
|
|
186
|
+
<BenchmarkCasePanel
|
|
187
|
+
selectedCase={selectedCase}
|
|
188
|
+
latestResult={latestResult}
|
|
189
|
+
activeRun={activeRun}
|
|
190
|
+
activeRunId={activeRunId}
|
|
191
|
+
progressPercent={progressPercent}
|
|
192
|
+
onRunCase={() => void (selectedCase && handleRunSpecificCase(selectedCase))}
|
|
193
|
+
/>
|
|
194
|
+
</div>
|
|
195
|
+
</div>
|
|
196
|
+
)
|
|
197
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { BenchmarkResult, BenchmarkRunSummary } from '@vibe-forge/core'
|
|
2
|
+
|
|
3
|
+
// ─── Formatting ───────────────────────────────────────────────────────────────
|
|
4
|
+
|
|
5
|
+
export const isTerminalRun = (run?: BenchmarkRunSummary | null) =>
|
|
6
|
+
run?.status === 'completed' || run?.status === 'failed'
|
|
7
|
+
|
|
8
|
+
export const formatTimestamp = (value?: string | null): string => {
|
|
9
|
+
if (!value) return '-'
|
|
10
|
+
return new Date(value).toLocaleString()
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// ─── Result status helpers ────────────────────────────────────────────────────
|
|
14
|
+
|
|
15
|
+
export const getResultStatusMeta = (result?: BenchmarkResult | null) => {
|
|
16
|
+
if (result == null) return { icon: 'radio_button_unchecked', statusKey: 'no-result' }
|
|
17
|
+
if (result.status === 'pass') return { icon: 'check_circle', statusKey: 'pass' }
|
|
18
|
+
if (result.status === 'partial') return { icon: 'rule', statusKey: 'partial' }
|
|
19
|
+
return { icon: 'cancel', statusKey: 'fail' }
|
|
20
|
+
}
|
|
21
|
+
|
package/src/components/Chat.tsx
CHANGED
|
@@ -1,40 +1,51 @@
|
|
|
1
1
|
import './Chat.scss'
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import type { Session } from '@vibe-forge/core'
|
|
3
|
+
import type { ChatMessage, ChatMessageContent, Session } from '@vibe-forge/core'
|
|
6
4
|
import { ChatHeader } from './chat/ChatHeader.js'
|
|
7
5
|
import { ChatHistoryView } from './chat/ChatHistoryView.js'
|
|
8
6
|
import { ChatSettingsView } from './chat/ChatSettingsView.js'
|
|
9
7
|
import { ChatTimelineView } from './chat/ChatTimelineView.js'
|
|
10
|
-
import {
|
|
11
|
-
import { useChatSession } from './chat/useChatSession.js'
|
|
8
|
+
import { useChatSession } from '#~/hooks/chat/use-chat-session'
|
|
12
9
|
|
|
13
10
|
export function Chat({
|
|
14
11
|
session
|
|
15
12
|
}: {
|
|
16
13
|
session?: Session
|
|
17
14
|
}) {
|
|
18
|
-
const { t } = useTranslation()
|
|
19
|
-
const { selectedModel, setSelectedModel, modelOptions, hasAvailableModels } = useChatModels()
|
|
20
15
|
const {
|
|
21
16
|
messages,
|
|
22
17
|
sessionInfo,
|
|
23
18
|
interactionRequest,
|
|
24
|
-
isCreating,
|
|
25
19
|
isReady,
|
|
26
|
-
isThinking,
|
|
27
20
|
activeView,
|
|
28
21
|
setActiveView,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
22
|
+
handleInteractionResponse,
|
|
23
|
+
setMessages,
|
|
24
|
+
placeholder,
|
|
25
|
+
modelOptions,
|
|
26
|
+
selectedModel,
|
|
27
|
+
modelForQuery,
|
|
28
|
+
setSelectedModel,
|
|
29
|
+
permissionMode,
|
|
30
|
+
setPermissionMode,
|
|
31
|
+
permissionModeOptions,
|
|
32
|
+
selectedAdapter,
|
|
33
|
+
setSelectedAdapter,
|
|
34
|
+
adapterOptions,
|
|
35
|
+
hasAvailableModels,
|
|
36
|
+
modelUnavailable
|
|
37
|
+
} = useChatSession({ session })
|
|
38
|
+
const buildUserMessage = (content: string | ChatMessageContent[]): ChatMessage => {
|
|
39
|
+
const id = globalThis.crypto?.randomUUID
|
|
40
|
+
? globalThis.crypto.randomUUID()
|
|
41
|
+
: `local-${Date.now()}-${Math.random().toString(16).slice(2)}`
|
|
42
|
+
return {
|
|
43
|
+
id,
|
|
44
|
+
role: 'user' as const,
|
|
45
|
+
content,
|
|
46
|
+
createdAt: Date.now()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
38
49
|
|
|
39
50
|
return (
|
|
40
51
|
<div className={`chat-container ${isReady ? 'ready' : ''} ${!session?.id ? 'is-new-session' : ''}`}>
|
|
@@ -59,26 +70,29 @@ export function Chat({
|
|
|
59
70
|
messages={messages}
|
|
60
71
|
session={session}
|
|
61
72
|
sessionInfo={sessionInfo}
|
|
62
|
-
isCreating={isCreating}
|
|
63
|
-
showScrollBottom={showScrollBottom}
|
|
64
|
-
messagesContainerRef={messagesContainerRef}
|
|
65
|
-
messagesEndRef={messagesEndRef}
|
|
66
|
-
scrollToBottom={scrollToBottom}
|
|
67
73
|
interactionRequest={interactionRequest}
|
|
68
74
|
onInteractionResponse={handleInteractionResponse}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
placeholder={
|
|
75
|
+
onClearMessages={() => setMessages([])}
|
|
76
|
+
onSend={(text) => setMessages((prev) => [...prev, buildUserMessage(text)])}
|
|
77
|
+
onSendContent={(content) => setMessages((prev) => [...prev, buildUserMessage(content)])}
|
|
78
|
+
placeholder={placeholder}
|
|
73
79
|
modelOptions={modelOptions}
|
|
74
80
|
selectedModel={selectedModel}
|
|
81
|
+
modelForQuery={modelForQuery}
|
|
75
82
|
onModelChange={setSelectedModel}
|
|
76
|
-
|
|
83
|
+
permissionMode={permissionMode}
|
|
84
|
+
permissionModeOptions={permissionModeOptions}
|
|
85
|
+
onPermissionModeChange={setPermissionMode}
|
|
86
|
+
selectedAdapter={selectedAdapter}
|
|
87
|
+
adapterOptions={adapterOptions}
|
|
88
|
+
onAdapterChange={setSelectedAdapter}
|
|
89
|
+
modelUnavailable={modelUnavailable}
|
|
90
|
+
hasAvailableModels={hasAvailableModels}
|
|
77
91
|
/>
|
|
78
92
|
)}
|
|
79
93
|
|
|
80
94
|
{activeView === 'timeline' && (
|
|
81
|
-
<ChatTimelineView messages={messages}
|
|
95
|
+
<ChatTimelineView messages={messages} />
|
|
82
96
|
)}
|
|
83
97
|
|
|
84
98
|
{activeView === 'settings' && session?.id && (
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import './CodeBlock.scss'
|
|
2
|
+
|
|
2
3
|
import { useAtomValue } from 'jotai'
|
|
3
4
|
import React, { useEffect, useState } from 'react'
|
|
4
5
|
import { codeToHtml } from 'shiki'
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
import { themeAtom } from '#~/store/index.js'
|
|
6
8
|
|
|
7
9
|
export function CodeBlock({
|
|
8
10
|
code,
|
|
@@ -8,6 +8,7 @@ import useSWR from 'swr'
|
|
|
8
8
|
import type { AboutInfo, ConfigResponse, ConfigSource } from '@vibe-forge/core'
|
|
9
9
|
|
|
10
10
|
import { getConfig, updateConfig } from '../api'
|
|
11
|
+
import { useQueryParams } from '../hooks/useQueryParams'
|
|
11
12
|
import { AboutSection, ConfigSectionPanel, ConfigSourceSwitch, DisplayValue } from './config'
|
|
12
13
|
import { AppSettingsPanel } from './config/AppSettingsPanel'
|
|
13
14
|
import { cloneValue, getValueByPath, isEmptyValue } from './config/configUtils'
|
|
@@ -16,8 +17,12 @@ export function ConfigView() {
|
|
|
16
17
|
const { t } = useTranslation()
|
|
17
18
|
const { message } = App.useApp()
|
|
18
19
|
const { data, isLoading, error, mutate } = useSWR<ConfigResponse>('/api/config', getConfig)
|
|
19
|
-
const
|
|
20
|
-
|
|
20
|
+
const { values: queryValues, update: updateQuery, searchParams } = useQueryParams<{ tab: string; source: string }>({
|
|
21
|
+
keys: ['tab', 'source'],
|
|
22
|
+
defaults: { tab: 'general', source: 'project' },
|
|
23
|
+
})
|
|
24
|
+
const sourceKey: ConfigSource = queryValues.source === 'user' ? 'user' : 'project'
|
|
25
|
+
const setSourceKey = (next: ConfigSource) => updateQuery({ source: next })
|
|
21
26
|
const [drafts, setDrafts] = useState<Record<string, unknown>>({})
|
|
22
27
|
const configPresent = data?.meta?.configPresent
|
|
23
28
|
const currentSource = data?.sources?.[sourceKey]
|
|
@@ -33,10 +38,11 @@ export function ConfigView() {
|
|
|
33
38
|
])
|
|
34
39
|
|
|
35
40
|
useEffect(() => {
|
|
41
|
+
if (searchParams.get('source') != null) return
|
|
36
42
|
if (configPresent?.project) {
|
|
37
|
-
|
|
43
|
+
updateQuery({ source: 'project' })
|
|
38
44
|
} else if (configPresent?.user) {
|
|
39
|
-
|
|
45
|
+
updateQuery({ source: 'user' })
|
|
40
46
|
}
|
|
41
47
|
}, [configPresent?.project, configPresent?.user])
|
|
42
48
|
|
|
@@ -45,6 +51,7 @@ export function ConfigView() {
|
|
|
45
51
|
'general',
|
|
46
52
|
'conversation',
|
|
47
53
|
'modelServices',
|
|
54
|
+
'channels',
|
|
48
55
|
'adapters',
|
|
49
56
|
'plugins',
|
|
50
57
|
'mcp',
|
|
@@ -66,6 +73,12 @@ export function ConfigView() {
|
|
|
66
73
|
label: t('config.sections.modelServices'),
|
|
67
74
|
value: currentSource?.modelServices
|
|
68
75
|
},
|
|
76
|
+
{
|
|
77
|
+
key: 'channels',
|
|
78
|
+
icon: 'campaign',
|
|
79
|
+
label: t('config.sections.channels'),
|
|
80
|
+
value: currentSource?.channels
|
|
81
|
+
},
|
|
69
82
|
{
|
|
70
83
|
key: 'adapters',
|
|
71
84
|
icon: 'settings_input_component',
|
|
@@ -82,26 +95,10 @@ export function ConfigView() {
|
|
|
82
95
|
], [currentSource, data?.meta?.about, data?.meta?.experiments, t])
|
|
83
96
|
const tabKeys = useMemo(() => new Set(tabs.filter(tab => tab.type !== 'group').map(tab => tab.key)), [tabs])
|
|
84
97
|
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
const initializedTabRef = useRef(false)
|
|
88
|
-
useEffect(() => {
|
|
89
|
-
if (initializedTabRef.current) return
|
|
90
|
-
const params = new URLSearchParams(window.location.search)
|
|
91
|
-
const tabKey = params.get('tab')
|
|
92
|
-
if (tabKey != null && tabKeys.has(tabKey)) {
|
|
93
|
-
setActiveTabKey(tabKey)
|
|
94
|
-
}
|
|
95
|
-
initializedTabRef.current = true
|
|
96
|
-
}, [tabKeys])
|
|
98
|
+
const activeTabKey = tabKeys.has(queryValues.tab) ? queryValues.tab : 'general'
|
|
99
|
+
const setActiveTabKey = (key: string) => updateQuery({ tab: key })
|
|
97
100
|
|
|
98
|
-
|
|
99
|
-
if (!tabKeys.has(activeTabKey)) return
|
|
100
|
-
const params = new URLSearchParams(window.location.search)
|
|
101
|
-
params.set('tab', activeTabKey)
|
|
102
|
-
const nextUrl = `${window.location.pathname}?${params.toString()}${window.location.hash}`
|
|
103
|
-
window.history.replaceState(null, '', nextUrl)
|
|
104
|
-
}, [activeTabKey, tabKeys])
|
|
101
|
+
const activeTab = useMemo(() => tabs.find(tab => tab.key === activeTabKey), [tabs, activeTabKey])
|
|
105
102
|
|
|
106
103
|
useEffect(() => {
|
|
107
104
|
if (activeTab == null) return
|
|
@@ -244,8 +241,18 @@ export function ConfigView() {
|
|
|
244
241
|
<ConfigSourceSwitch
|
|
245
242
|
value={sourceKey}
|
|
246
243
|
onChange={setSourceKey}
|
|
247
|
-
|
|
248
|
-
|
|
244
|
+
options={[
|
|
245
|
+
{
|
|
246
|
+
value: 'project',
|
|
247
|
+
icon: 'folder',
|
|
248
|
+
label: configPresent?.project === true ? t('config.sources.project') : t('config.sources.projectMissing')
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
value: 'user',
|
|
252
|
+
icon: 'person',
|
|
253
|
+
label: configPresent?.user === true ? t('config.sources.user') : t('config.sources.userMissing')
|
|
254
|
+
}
|
|
255
|
+
]}
|
|
249
256
|
/>
|
|
250
257
|
</Space>
|
|
251
258
|
)}
|
|
@@ -108,6 +108,13 @@ export function NavRail({
|
|
|
108
108
|
path: '/automation',
|
|
109
109
|
active: currentPath === '/automation'
|
|
110
110
|
},
|
|
111
|
+
{
|
|
112
|
+
key: 'benchmark',
|
|
113
|
+
icon: 'speed',
|
|
114
|
+
label: t('common.benchmark'),
|
|
115
|
+
path: '/benchmark',
|
|
116
|
+
active: currentPath === '/benchmark'
|
|
117
|
+
},
|
|
111
118
|
{
|
|
112
119
|
key: 'archive',
|
|
113
120
|
icon: 'archive',
|
|
@@ -64,22 +64,16 @@
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
.chat-header-view-group {
|
|
67
|
-
.ant-radio-button-wrapper {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
67
|
+
.ant-radio-button-wrapper .ant-radio-button-label {
|
|
68
|
+
display: flex;
|
|
69
|
+
align-items: center;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
height: 100%;
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
.chat-header-view-option {
|
|
76
|
-
|
|
77
|
-
align-items: center;
|
|
78
|
-
gap: 6px;
|
|
79
|
-
|
|
80
|
-
.material-symbols-rounded {
|
|
81
|
-
font-size: 16px;
|
|
82
|
-
}
|
|
75
|
+
.chat-header-view-option.material-symbols-rounded {
|
|
76
|
+
font-size: 16px;
|
|
83
77
|
}
|
|
84
78
|
|
|
85
79
|
.material-symbols-rounded.is-filled {
|
|
@@ -271,15 +265,27 @@
|
|
|
271
265
|
&.archive-action {
|
|
272
266
|
&:hover {
|
|
273
267
|
border-color: var(--danger-color);
|
|
274
|
-
background-color: color-mix(
|
|
268
|
+
background-color: color-mix(
|
|
269
|
+
in srgb,
|
|
270
|
+
var(--danger-color) 12%,
|
|
271
|
+
transparent
|
|
272
|
+
);
|
|
275
273
|
color: var(--danger-color);
|
|
276
274
|
}
|
|
277
275
|
&.active {
|
|
278
|
-
background-color: color-mix(
|
|
276
|
+
background-color: color-mix(
|
|
277
|
+
in srgb,
|
|
278
|
+
var(--danger-color) 18%,
|
|
279
|
+
transparent
|
|
280
|
+
);
|
|
279
281
|
border-color: var(--danger-color);
|
|
280
282
|
color: var(--danger-color);
|
|
281
283
|
&:hover {
|
|
282
|
-
background-color: color-mix(
|
|
284
|
+
background-color: color-mix(
|
|
285
|
+
in srgb,
|
|
286
|
+
var(--danger-color) 24%,
|
|
287
|
+
transparent
|
|
288
|
+
);
|
|
283
289
|
}
|
|
284
290
|
}
|
|
285
291
|
}
|
|
@@ -349,15 +355,27 @@ html.dark {
|
|
|
349
355
|
|
|
350
356
|
&.archive-action {
|
|
351
357
|
&:hover {
|
|
352
|
-
background-color: color-mix(
|
|
358
|
+
background-color: color-mix(
|
|
359
|
+
in srgb,
|
|
360
|
+
var(--danger-color) 22%,
|
|
361
|
+
transparent
|
|
362
|
+
);
|
|
353
363
|
color: var(--danger-color);
|
|
354
364
|
}
|
|
355
365
|
&.active {
|
|
356
|
-
background-color: color-mix(
|
|
366
|
+
background-color: color-mix(
|
|
367
|
+
in srgb,
|
|
368
|
+
var(--danger-color) 26%,
|
|
369
|
+
transparent
|
|
370
|
+
);
|
|
357
371
|
border-color: var(--danger-color);
|
|
358
372
|
color: var(--danger-color);
|
|
359
373
|
&:hover {
|
|
360
|
-
background-color: color-mix(
|
|
374
|
+
background-color: color-mix(
|
|
375
|
+
in srgb,
|
|
376
|
+
var(--danger-color) 32%,
|
|
377
|
+
transparent
|
|
378
|
+
);
|
|
361
379
|
}
|
|
362
380
|
}
|
|
363
381
|
}
|
|
@@ -147,27 +147,24 @@ export function ChatHeader({
|
|
|
147
147
|
options={[
|
|
148
148
|
{
|
|
149
149
|
label: (
|
|
150
|
-
<span className='chat-header-view-option'>
|
|
151
|
-
|
|
152
|
-
<span>{t('chat.viewHistory')}</span>
|
|
150
|
+
<span className='chat-header-view-option material-symbols-rounded'>
|
|
151
|
+
forum
|
|
153
152
|
</span>
|
|
154
153
|
),
|
|
155
154
|
value: 'history'
|
|
156
155
|
},
|
|
157
156
|
{
|
|
158
157
|
label: (
|
|
159
|
-
<span className='chat-header-view-option'>
|
|
160
|
-
|
|
161
|
-
<span>{t('chat.viewTimeline')}</span>
|
|
158
|
+
<span className='chat-header-view-option material-symbols-rounded'>
|
|
159
|
+
timeline
|
|
162
160
|
</span>
|
|
163
161
|
),
|
|
164
162
|
value: 'timeline'
|
|
165
163
|
},
|
|
166
164
|
{
|
|
167
165
|
label: (
|
|
168
|
-
<span className='chat-header-view-option'>
|
|
169
|
-
|
|
170
|
-
<span>{t('chat.viewSettings')}</span>
|
|
166
|
+
<span className='chat-header-view-option material-symbols-rounded'>
|
|
167
|
+
tune
|
|
171
168
|
</span>
|
|
172
169
|
),
|
|
173
170
|
value: 'settings'
|