@vibe-forge/client 0.2.0-alpha.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/LICENSE +21 -0
- package/cli.cjs +6 -0
- package/index.html +27 -0
- package/package.json +42 -0
- package/src/App.tsx +174 -0
- package/src/api.ts +241 -0
- package/src/components/ArchiveView.scss +168 -0
- package/src/components/ArchiveView.tsx +299 -0
- package/src/components/AutomationView/AutomationView.scss +26 -0
- package/src/components/AutomationView/RuleFormPanel.scss +129 -0
- package/src/components/AutomationView/RuleFormPanel.tsx +257 -0
- package/src/components/AutomationView/RuleSidebar.scss +219 -0
- package/src/components/AutomationView/RuleSidebar.tsx +258 -0
- package/src/components/AutomationView/RunHistoryPanel.scss +286 -0
- package/src/components/AutomationView/RunHistoryPanel.tsx +320 -0
- package/src/components/AutomationView/TaskList.scss +128 -0
- package/src/components/AutomationView/TaskList.tsx +79 -0
- package/src/components/AutomationView/TriggerList.scss +153 -0
- package/src/components/AutomationView/TriggerList.tsx +217 -0
- package/src/components/AutomationView/index.tsx +228 -0
- package/src/components/AutomationView/types.ts +21 -0
- package/src/components/Chat.scss +89 -0
- package/src/components/Chat.tsx +92 -0
- package/src/components/ConfigView.scss +185 -0
- package/src/components/ConfigView.tsx +258 -0
- package/src/components/NavRail.scss +71 -0
- package/src/components/NavRail.tsx +188 -0
- package/src/components/Sidebar.scss +112 -0
- package/src/components/Sidebar.tsx +291 -0
- package/src/components/chat/ChatHeader.scss +401 -0
- package/src/components/chat/ChatHeader.tsx +342 -0
- package/src/components/chat/ChatHistoryView.tsx +122 -0
- package/src/components/chat/ChatSettingsView.tsx +22 -0
- package/src/components/chat/ChatTimelineView.scss +53 -0
- package/src/components/chat/ChatTimelineView.tsx +158 -0
- package/src/components/chat/CodeBlock.scss +87 -0
- package/src/components/chat/CodeBlock.tsx +179 -0
- package/src/components/chat/CompletionMenu.scss +70 -0
- package/src/components/chat/CompletionMenu.tsx +58 -0
- package/src/components/chat/CurrentTodoList.scss +217 -0
- package/src/components/chat/CurrentTodoList.tsx +103 -0
- package/src/components/chat/MarkdownContent.tsx +43 -0
- package/src/components/chat/MessageFooter.tsx +48 -0
- package/src/components/chat/MessageItem.scss +251 -0
- package/src/components/chat/MessageItem.tsx +78 -0
- package/src/components/chat/NewSessionGuide.scss +186 -0
- package/src/components/chat/NewSessionGuide.tsx +167 -0
- package/src/components/chat/Sender.scss +367 -0
- package/src/components/chat/Sender.tsx +541 -0
- package/src/components/chat/SessionTimelinePanel/EventList.scss +58 -0
- package/src/components/chat/SessionTimelinePanel/EventList.tsx +212 -0
- package/src/components/chat/SessionTimelinePanel/gantt.ts +177 -0
- package/src/components/chat/SessionTimelinePanel/git-graph.ts +518 -0
- package/src/components/chat/SessionTimelinePanel/index.scss +28 -0
- package/src/components/chat/SessionTimelinePanel/index.tsx +121 -0
- package/src/components/chat/SessionTimelinePanel/mermaid.ts +4 -0
- package/src/components/chat/SessionTimelinePanel/types.ts +64 -0
- package/src/components/chat/SessionTimelinePanel/utils.ts +20 -0
- package/src/components/chat/ThinkingStatus.scss +70 -0
- package/src/components/chat/ThinkingStatus.tsx +13 -0
- package/src/components/chat/ToolCallBox.scss +137 -0
- package/src/components/chat/ToolCallBox.tsx +55 -0
- package/src/components/chat/ToolGroup.scss +154 -0
- package/src/components/chat/ToolGroup.tsx +102 -0
- package/src/components/chat/ToolRenderer.tsx +45 -0
- package/src/components/chat/messageUtils.ts +171 -0
- package/src/components/chat/safeSerialize.ts +84 -0
- package/src/components/chat/tools/DefaultTool.tsx +63 -0
- package/src/components/chat/tools/adapter-claude/BashTool.scss +71 -0
- package/src/components/chat/tools/adapter-claude/BashTool.tsx +82 -0
- package/src/components/chat/tools/adapter-claude/GlobTool.scss +88 -0
- package/src/components/chat/tools/adapter-claude/GlobTool.tsx +85 -0
- package/src/components/chat/tools/adapter-claude/GrepTool.scss +96 -0
- package/src/components/chat/tools/adapter-claude/GrepTool.tsx +114 -0
- package/src/components/chat/tools/adapter-claude/LSTool.scss +85 -0
- package/src/components/chat/tools/adapter-claude/LSTool.tsx +94 -0
- package/src/components/chat/tools/adapter-claude/ReadTool.scss +57 -0
- package/src/components/chat/tools/adapter-claude/ReadTool.tsx +87 -0
- package/src/components/chat/tools/adapter-claude/TodoTool.scss +78 -0
- package/src/components/chat/tools/adapter-claude/TodoTool.tsx +60 -0
- package/src/components/chat/tools/adapter-claude/WriteTool.scss +92 -0
- package/src/components/chat/tools/adapter-claude/WriteTool.tsx +86 -0
- package/src/components/chat/tools/adapter-claude/components/FileList.scss +65 -0
- package/src/components/chat/tools/adapter-claude/components/FileList.tsx +185 -0
- package/src/components/chat/tools/adapter-claude/index.ts +28 -0
- package/src/components/chat/tools/defineToolRender.ts +28 -0
- package/src/components/chat/tools/task/GetTaskInfoTool.scss +50 -0
- package/src/components/chat/tools/task/GetTaskInfoTool.tsx +88 -0
- package/src/components/chat/tools/task/ListTasksTool.scss +56 -0
- package/src/components/chat/tools/task/ListTasksTool.tsx +83 -0
- package/src/components/chat/tools/task/StartTasksTool.scss +56 -0
- package/src/components/chat/tools/task/StartTasksTool.tsx +96 -0
- package/src/components/chat/tools/task/components/TaskToolCard.scss +127 -0
- package/src/components/chat/tools/task/components/TaskToolCard.tsx +177 -0
- package/src/components/chat/tools/task/index.ts +15 -0
- package/src/components/chat/useChatModels.tsx +206 -0
- package/src/components/chat/useChatSession.ts +370 -0
- package/src/components/config/ConfigAboutSection.scss +111 -0
- package/src/components/config/ConfigAboutSection.tsx +86 -0
- package/src/components/config/ConfigDisplayValue.scss +22 -0
- package/src/components/config/ConfigDisplayValue.tsx +62 -0
- package/src/components/config/ConfigEditors.scss +65 -0
- package/src/components/config/ConfigEditors.tsx +98 -0
- package/src/components/config/ConfigFieldRow.scss +97 -0
- package/src/components/config/ConfigFieldRow.tsx +36 -0
- package/src/components/config/ConfigSectionForm.scss +94 -0
- package/src/components/config/ConfigSectionForm.tsx +436 -0
- package/src/components/config/ConfigSectionPanel.tsx +67 -0
- package/src/components/config/ConfigShortcutInput.scss +11 -0
- package/src/components/config/ConfigShortcutInput.tsx +52 -0
- package/src/components/config/ConfigSourceSwitch.tsx +57 -0
- package/src/components/config/configSchema.ts +319 -0
- package/src/components/config/configUtils.ts +83 -0
- package/src/components/config/index.tsx +5 -0
- package/src/components/config/recordEditors/BooleanRecordEditor.scss +1 -0
- package/src/components/config/recordEditors/BooleanRecordEditor.tsx +75 -0
- package/src/components/config/recordEditors/KeyValueEditor.scss +1 -0
- package/src/components/config/recordEditors/KeyValueEditor.tsx +97 -0
- package/src/components/config/recordEditors/McpServersRecordEditor.scss +1 -0
- package/src/components/config/recordEditors/McpServersRecordEditor.tsx +258 -0
- package/src/components/config/recordEditors/ModelServicesRecordEditor.scss +1 -0
- package/src/components/config/recordEditors/ModelServicesRecordEditor.tsx +233 -0
- package/src/components/config/recordEditors/RecordEditors.scss +117 -0
- package/src/components/config/recordEditors/RecordJsonEditor.scss +1 -0
- package/src/components/config/recordEditors/RecordJsonEditor.tsx +113 -0
- package/src/components/config/recordEditors/index.tsx +5 -0
- package/src/components/knowledge-base/KnowledgeBaseView.scss +19 -0
- package/src/components/knowledge-base/KnowledgeBaseView.tsx +186 -0
- package/src/components/knowledge-base/components/ActionButton.scss +5 -0
- package/src/components/knowledge-base/components/ActionButton.tsx +9 -0
- package/src/components/knowledge-base/components/EmptyState.scss +19 -0
- package/src/components/knowledge-base/components/EmptyState.tsx +42 -0
- package/src/components/knowledge-base/components/EntitiesTab.scss +5 -0
- package/src/components/knowledge-base/components/EntitiesTab.tsx +80 -0
- package/src/components/knowledge-base/components/EntityItem.scss +82 -0
- package/src/components/knowledge-base/components/EntityItem.tsx +79 -0
- package/src/components/knowledge-base/components/EntityList.scss +5 -0
- package/src/components/knowledge-base/components/EntityList.tsx +70 -0
- package/src/components/knowledge-base/components/FilterBar.scss +21 -0
- package/src/components/knowledge-base/components/FilterBar.tsx +51 -0
- package/src/components/knowledge-base/components/FlowsTab.scss +5 -0
- package/src/components/knowledge-base/components/FlowsTab.tsx +80 -0
- package/src/components/knowledge-base/components/KnowledgeBaseHeader.scss +27 -0
- package/src/components/knowledge-base/components/KnowledgeBaseHeader.tsx +29 -0
- package/src/components/knowledge-base/components/KnowledgeList.scss +19 -0
- package/src/components/knowledge-base/components/KnowledgeList.tsx +19 -0
- package/src/components/knowledge-base/components/LoadingState.scss +5 -0
- package/src/components/knowledge-base/components/LoadingState.tsx +11 -0
- package/src/components/knowledge-base/components/MetaList.scss +19 -0
- package/src/components/knowledge-base/components/MetaList.tsx +18 -0
- package/src/components/knowledge-base/components/RulesTab.scss +5 -0
- package/src/components/knowledge-base/components/RulesTab.tsx +49 -0
- package/src/components/knowledge-base/components/SectionHeader.scss +22 -0
- package/src/components/knowledge-base/components/SectionHeader.tsx +21 -0
- package/src/components/knowledge-base/components/SkillsTab.scss +5 -0
- package/src/components/knowledge-base/components/SkillsTab.tsx +49 -0
- package/src/components/knowledge-base/components/SpecItem.scss +138 -0
- package/src/components/knowledge-base/components/SpecItem.tsx +131 -0
- package/src/components/knowledge-base/components/SpecList.scss +5 -0
- package/src/components/knowledge-base/components/SpecList.tsx +70 -0
- package/src/components/knowledge-base/components/TabContent.scss +8 -0
- package/src/components/knowledge-base/components/TabContent.tsx +17 -0
- package/src/components/knowledge-base/components/TabLabel.scss +10 -0
- package/src/components/knowledge-base/components/TabLabel.tsx +15 -0
- package/src/components/knowledge-base/index.tsx +1 -0
- package/src/components/sidebar/SessionItem.scss +256 -0
- package/src/components/sidebar/SessionItem.tsx +265 -0
- package/src/components/sidebar/SessionList.scss +92 -0
- package/src/components/sidebar/SessionList.tsx +166 -0
- package/src/components/sidebar/SidebarHeader.scss +79 -0
- package/src/components/sidebar/SidebarHeader.tsx +128 -0
- package/src/connectionManager.ts +172 -0
- package/src/hooks/useGlobalShortcut.ts +26 -0
- package/src/hooks/useQueryParams.ts +54 -0
- package/src/i18n.ts +22 -0
- package/src/main.tsx +41 -0
- package/src/resources/locales/en.json +765 -0
- package/src/resources/locales/zh.json +766 -0
- package/src/store/index.ts +23 -0
- package/src/styles/global.scss +100 -0
- package/src/utils/shortcutUtils.ts +88 -0
- package/src/vite-env.d.ts +12 -0
- package/src/ws.ts +33 -0
- package/vite.config.ts +26 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import ReactMarkdown from 'react-markdown'
|
|
3
|
+
import remarkGfm from 'remark-gfm'
|
|
4
|
+
import { CodeBlock } from './CodeBlock'
|
|
5
|
+
|
|
6
|
+
export function MarkdownContent({
|
|
7
|
+
content
|
|
8
|
+
}: {
|
|
9
|
+
content: string
|
|
10
|
+
}) {
|
|
11
|
+
return (
|
|
12
|
+
<div className='markdown-body'>
|
|
13
|
+
<ReactMarkdown
|
|
14
|
+
remarkPlugins={[remarkGfm]}
|
|
15
|
+
components={{
|
|
16
|
+
pre({ children }) {
|
|
17
|
+
return <>{children}</>
|
|
18
|
+
},
|
|
19
|
+
code({ inline, className, children, ...props }: any) {
|
|
20
|
+
const langClass = typeof className === 'string' ? className : ''
|
|
21
|
+
const match = /language-(\w+)/.exec(langClass)
|
|
22
|
+
const isInline = inline === true
|
|
23
|
+
const codeContent = String(children).replace(/\n$/, '')
|
|
24
|
+
return !isInline && match != null
|
|
25
|
+
? (
|
|
26
|
+
<CodeBlock
|
|
27
|
+
code={codeContent}
|
|
28
|
+
lang={match[1]}
|
|
29
|
+
/>
|
|
30
|
+
)
|
|
31
|
+
: (
|
|
32
|
+
<code className={langClass} {...props}>
|
|
33
|
+
{children}
|
|
34
|
+
</code>
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
}}
|
|
38
|
+
>
|
|
39
|
+
{content}
|
|
40
|
+
</ReactMarkdown>
|
|
41
|
+
</div>
|
|
42
|
+
)
|
|
43
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ChatMessage } from '@vibe-forge/core'
|
|
2
|
+
import { App } from 'antd'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
export function MessageFooter({
|
|
6
|
+
msg,
|
|
7
|
+
isUser
|
|
8
|
+
}: {
|
|
9
|
+
msg: ChatMessage
|
|
10
|
+
isUser: boolean
|
|
11
|
+
}) {
|
|
12
|
+
const { message } = App.useApp()
|
|
13
|
+
|
|
14
|
+
return (
|
|
15
|
+
<div className='msg-footer'>
|
|
16
|
+
{isUser && msg.model != null && (
|
|
17
|
+
<span className='msg-model'>
|
|
18
|
+
{msg.model.split(',').pop()}
|
|
19
|
+
</span>
|
|
20
|
+
)}
|
|
21
|
+
{isUser && msg.usage != null && (
|
|
22
|
+
<span className='msg-usage'>
|
|
23
|
+
Tokens: {msg.usage.input_tokens + msg.usage.output_tokens}
|
|
24
|
+
</span>
|
|
25
|
+
)}
|
|
26
|
+
<span
|
|
27
|
+
className='timestamp'
|
|
28
|
+
onDoubleClick={() => {
|
|
29
|
+
// eslint-disable-next-line no-console
|
|
30
|
+
console.log('Debug Message:', msg)
|
|
31
|
+
void navigator.clipboard.writeText(new Date(msg.createdAt).toISOString())
|
|
32
|
+
void message.success('ISO 时间已复制到剪贴板')
|
|
33
|
+
}}
|
|
34
|
+
title='双击复制 ISO 时间 (控制台打印消息结构)'
|
|
35
|
+
>
|
|
36
|
+
{new Date(msg.createdAt).toLocaleString('zh-CN', {
|
|
37
|
+
year: 'numeric',
|
|
38
|
+
month: '2-digit',
|
|
39
|
+
day: '2-digit',
|
|
40
|
+
hour: '2-digit',
|
|
41
|
+
minute: '2-digit',
|
|
42
|
+
second: '2-digit',
|
|
43
|
+
hour12: false
|
|
44
|
+
})}
|
|
45
|
+
</span>
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
.chat-message-user, .chat-message-assistant {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: flex-start;
|
|
4
|
+
margin-top: 12px;
|
|
5
|
+
margin-bottom: 0;
|
|
6
|
+
position: relative;
|
|
7
|
+
|
|
8
|
+
.message-body-container {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
max-width: 90%;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.bubble {
|
|
15
|
+
position: relative;
|
|
16
|
+
width: fit-content;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.msg-footer {
|
|
20
|
+
opacity: 0;
|
|
21
|
+
transition: opacity .2s ease;
|
|
22
|
+
margin-top: 4px;
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
gap: 8px;
|
|
26
|
+
font-size: 11px;
|
|
27
|
+
color: var(--sub-text-color, #9ca3af);
|
|
28
|
+
|
|
29
|
+
.timestamp {
|
|
30
|
+
user-select: none;
|
|
31
|
+
cursor: pointer;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
&.chat-message-user {
|
|
36
|
+
.message-body-container {
|
|
37
|
+
align-items: flex-end;
|
|
38
|
+
}
|
|
39
|
+
.msg-footer {
|
|
40
|
+
justify-content: flex-end;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
&.chat-message-assistant {
|
|
45
|
+
.message-body-container {
|
|
46
|
+
align-items: flex-start;
|
|
47
|
+
width: 100%;
|
|
48
|
+
max-width: 100%;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
&:hover .msg-footer {
|
|
53
|
+
opacity: 1;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
&:first-child {
|
|
57
|
+
margin-top: 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.chat-message-user {
|
|
62
|
+
flex-direction: row-reverse;
|
|
63
|
+
gap: 8px;
|
|
64
|
+
|
|
65
|
+
&.consecutive {
|
|
66
|
+
margin-top: 4px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.bubble {
|
|
70
|
+
background-color: var(--user-bubble-bg, #3b82f6);
|
|
71
|
+
color: white;
|
|
72
|
+
padding: 8px 12px;
|
|
73
|
+
border-radius: 16px 0 16px 16px;
|
|
74
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
&.consecutive .bubble {
|
|
78
|
+
border-radius: 16px;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.chat-message-assistant {
|
|
83
|
+
flex-direction: row;
|
|
84
|
+
gap: 0;
|
|
85
|
+
padding-left: 0;
|
|
86
|
+
|
|
87
|
+
&.consecutive {
|
|
88
|
+
margin-top: 0;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.bubble {
|
|
92
|
+
background-color: transparent;
|
|
93
|
+
color: var(--text-color);
|
|
94
|
+
padding: 0;
|
|
95
|
+
max-width: 100%;
|
|
96
|
+
width: 100%;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
html.dark {
|
|
101
|
+
.chat-message-user {
|
|
102
|
+
--user-bubble-bg: #1d4ed8;
|
|
103
|
+
}
|
|
104
|
+
.chat-message-assistant {
|
|
105
|
+
.bubble {
|
|
106
|
+
color: #e5e7eb;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.markdown-body {
|
|
111
|
+
--border-color: #30363d;
|
|
112
|
+
--code-block-bg: #0d1117;
|
|
113
|
+
--code-header-bg: #161b22;
|
|
114
|
+
--hover-bg: rgba(255, 255, 255, .1);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.message-contents {
|
|
119
|
+
display: flex;
|
|
120
|
+
flex-direction: column;
|
|
121
|
+
gap: 4px;
|
|
122
|
+
width: 100%;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.markdown-body {
|
|
126
|
+
--border-color: #e5e7eb;
|
|
127
|
+
--code-block-bg: #ffffff;
|
|
128
|
+
--code-header-bg: #f6f8fa;
|
|
129
|
+
--hover-bg: rgba(0, 0, 0, .05);
|
|
130
|
+
|
|
131
|
+
font-size: 14px;
|
|
132
|
+
line-height: 1.5;
|
|
133
|
+
word-wrap: break-word;
|
|
134
|
+
width: 100%;
|
|
135
|
+
|
|
136
|
+
p {
|
|
137
|
+
margin: 0 0 4px 0;
|
|
138
|
+
&:last-child {
|
|
139
|
+
margin-bottom: 0;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
code {
|
|
144
|
+
background-color: var(--tag-bg, #f3f4f6);
|
|
145
|
+
padding: 1px 3px;
|
|
146
|
+
border-radius: 3px;
|
|
147
|
+
font-family:
|
|
148
|
+
'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
|
|
149
|
+
font-size: .9em;
|
|
150
|
+
color: var(--text-color);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
pre {
|
|
154
|
+
background-color: transparent;
|
|
155
|
+
padding: 0;
|
|
156
|
+
border-radius: 0;
|
|
157
|
+
overflow-x: visible;
|
|
158
|
+
margin: 8px 0;
|
|
159
|
+
|
|
160
|
+
code {
|
|
161
|
+
background-color: transparent;
|
|
162
|
+
padding: 0;
|
|
163
|
+
font-size: 12px;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
ul, ol {
|
|
168
|
+
margin: 4px 0;
|
|
169
|
+
padding-left: 18px;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
li {
|
|
173
|
+
margin-bottom: 2px;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
h1, h2, h3, h4, h5, h6 {
|
|
177
|
+
margin: 12px 0 6px 0;
|
|
178
|
+
font-weight: 600;
|
|
179
|
+
line-height: 1.25;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
a {
|
|
183
|
+
color: #3b82f6;
|
|
184
|
+
text-decoration: none;
|
|
185
|
+
&:hover {
|
|
186
|
+
text-decoration: underline;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
blockquote {
|
|
191
|
+
margin: 8px 0;
|
|
192
|
+
padding-left: 10px;
|
|
193
|
+
border-left: 3px solid #e5e7eb;
|
|
194
|
+
color: #6b7280;
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
table {
|
|
198
|
+
border-collapse: collapse;
|
|
199
|
+
width: 100%;
|
|
200
|
+
margin: 12px 0;
|
|
201
|
+
|
|
202
|
+
th, td {
|
|
203
|
+
border: 1px solid #e5e7eb;
|
|
204
|
+
padding: 6px 13px;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
tr:nth-child(2n) {
|
|
208
|
+
background-color: #f9fafb;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.chat-message-user {
|
|
214
|
+
.markdown-body {
|
|
215
|
+
color: white;
|
|
216
|
+
code {
|
|
217
|
+
background-color: rgba(255, 255, 255, .2);
|
|
218
|
+
color: white;
|
|
219
|
+
}
|
|
220
|
+
pre {
|
|
221
|
+
background-color: rgba(0, 0, 0, .1);
|
|
222
|
+
code {
|
|
223
|
+
background-color: transparent;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
a {
|
|
227
|
+
color: white;
|
|
228
|
+
text-decoration: underline;
|
|
229
|
+
}
|
|
230
|
+
blockquote {
|
|
231
|
+
border-left-color: rgba(255, 255, 255, .3);
|
|
232
|
+
color: rgba(255, 255, 255, .9);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.adapter-event-item {
|
|
238
|
+
opacity: 0;
|
|
239
|
+
transition: opacity .2s ease;
|
|
240
|
+
font-size: 11px;
|
|
241
|
+
color: #9ca3af;
|
|
242
|
+
margin: 2px 0;
|
|
243
|
+
padding: 2px 6px;
|
|
244
|
+
background-color: #f9fafb;
|
|
245
|
+
border-radius: 4px;
|
|
246
|
+
border: 1px solid #f3f4f6;
|
|
247
|
+
|
|
248
|
+
&:hover {
|
|
249
|
+
opacity: 1;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import './MessageItem.scss'
|
|
2
|
+
import type { ChatMessage } from '@vibe-forge/core'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
import { MessageFooter } from './MessageFooter'
|
|
5
|
+
import { MarkdownContent } from './MarkdownContent'
|
|
6
|
+
import { ToolRenderer } from './ToolRenderer'
|
|
7
|
+
|
|
8
|
+
export function MessageItem({
|
|
9
|
+
msg,
|
|
10
|
+
isFirstInGroup
|
|
11
|
+
}: {
|
|
12
|
+
msg: ChatMessage
|
|
13
|
+
isFirstInGroup: boolean
|
|
14
|
+
}) {
|
|
15
|
+
const isUser = msg.role === 'user'
|
|
16
|
+
|
|
17
|
+
const renderContent = () => {
|
|
18
|
+
if (msg.content == null) return null
|
|
19
|
+
|
|
20
|
+
if (typeof msg.content === 'string') {
|
|
21
|
+
return (
|
|
22
|
+
<MarkdownContent content={msg.content} />
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!Array.isArray(msg.content)) return null
|
|
27
|
+
|
|
28
|
+
const hasContent = msg.content.some(c => c.type === 'text') || msg.toolCall != null
|
|
29
|
+
if (!hasContent) return null
|
|
30
|
+
|
|
31
|
+
return (
|
|
32
|
+
<div className='message-contents'>
|
|
33
|
+
{msg.content.map((item, i) => {
|
|
34
|
+
if (item.type === 'text') {
|
|
35
|
+
return (
|
|
36
|
+
<MarkdownContent key={i} content={item.text} />
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
return null
|
|
40
|
+
})}
|
|
41
|
+
{msg.toolCall != null && (
|
|
42
|
+
<ToolRenderer
|
|
43
|
+
item={{
|
|
44
|
+
type: 'tool_use',
|
|
45
|
+
id: msg.toolCall.id ?? 'legacy',
|
|
46
|
+
name: msg.toolCall.name,
|
|
47
|
+
input: msg.toolCall.args
|
|
48
|
+
}}
|
|
49
|
+
resultItem={msg.toolCall.output != null
|
|
50
|
+
? {
|
|
51
|
+
type: 'tool_result',
|
|
52
|
+
tool_use_id: msg.toolCall.id ?? 'legacy',
|
|
53
|
+
content: msg.toolCall.output,
|
|
54
|
+
is_error: msg.toolCall.status === 'error'
|
|
55
|
+
}
|
|
56
|
+
: undefined}
|
|
57
|
+
/>
|
|
58
|
+
)}
|
|
59
|
+
</div>
|
|
60
|
+
)
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const content = renderContent()
|
|
64
|
+
if (content == null) return null
|
|
65
|
+
|
|
66
|
+
return (
|
|
67
|
+
<div
|
|
68
|
+
className={`${isUser ? 'chat-message-user' : 'chat-message-assistant'} ${!isFirstInGroup ? 'consecutive' : ''}`}
|
|
69
|
+
>
|
|
70
|
+
<div className='message-body-container'>
|
|
71
|
+
<div className='bubble'>
|
|
72
|
+
{content}
|
|
73
|
+
</div>
|
|
74
|
+
<MessageFooter msg={msg} isUser={isUser} />
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
.new-session-guide {
|
|
2
|
+
width: 100%;
|
|
3
|
+
max-width: 1100px;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
.new-session-guide__announcements {
|
|
7
|
+
border: 1px solid var(--border-color);
|
|
8
|
+
border-radius: 12px;
|
|
9
|
+
padding: 12px 16px;
|
|
10
|
+
margin-bottom: 16px;
|
|
11
|
+
background: var(--tag-bg);
|
|
12
|
+
display: flex;
|
|
13
|
+
flex-direction: column;
|
|
14
|
+
gap: 8px;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.new-session-guide__announcements-header {
|
|
18
|
+
display: inline-flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: 8px;
|
|
21
|
+
font-size: 13px;
|
|
22
|
+
font-weight: 600;
|
|
23
|
+
color: var(--text-color);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.new-session-guide__announcements-icon {
|
|
27
|
+
font-size: 18px;
|
|
28
|
+
color: var(--sub-text-color);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.new-session-guide__announcements-list {
|
|
32
|
+
display: flex;
|
|
33
|
+
flex-direction: column;
|
|
34
|
+
gap: 6px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.new-session-guide__announcements-item {
|
|
38
|
+
display: flex;
|
|
39
|
+
align-items: flex-start;
|
|
40
|
+
gap: 8px;
|
|
41
|
+
font-size: 12px;
|
|
42
|
+
color: var(--sub-text-color);
|
|
43
|
+
line-height: 1.4;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
.new-session-guide__grid {
|
|
47
|
+
display: grid;
|
|
48
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
49
|
+
gap: 16px;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.new-session-guide__card {
|
|
53
|
+
display: flex;
|
|
54
|
+
flex-direction: column;
|
|
55
|
+
gap: 12px;
|
|
56
|
+
border: 1px solid var(--border-color);
|
|
57
|
+
border-radius: 12px;
|
|
58
|
+
padding: 16px;
|
|
59
|
+
background: var(--bg-color);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.new-session-guide__header {
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: space-between;
|
|
66
|
+
gap: 8px;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.new-session-guide__title {
|
|
70
|
+
display: inline-flex;
|
|
71
|
+
align-items: center;
|
|
72
|
+
gap: 8px;
|
|
73
|
+
font-size: 14px;
|
|
74
|
+
font-weight: 600;
|
|
75
|
+
color: var(--text-color);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.new-session-guide__title-icon {
|
|
79
|
+
font-size: 18px;
|
|
80
|
+
color: var(--sub-text-color);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.new-session-guide__count {
|
|
84
|
+
padding: 2px 8px;
|
|
85
|
+
border-radius: 999px;
|
|
86
|
+
font-size: 12px;
|
|
87
|
+
color: var(--sub-text-color);
|
|
88
|
+
background: var(--tag-bg);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.new-session-guide__body {
|
|
92
|
+
display: flex;
|
|
93
|
+
flex-direction: column;
|
|
94
|
+
gap: 12px;
|
|
95
|
+
min-height: 160px;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.new-session-guide__list {
|
|
99
|
+
display: flex;
|
|
100
|
+
flex-direction: column;
|
|
101
|
+
gap: 10px;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.new-session-guide__item {
|
|
105
|
+
display: flex;
|
|
106
|
+
flex-direction: column;
|
|
107
|
+
gap: 4px;
|
|
108
|
+
padding: 10px 12px;
|
|
109
|
+
border-radius: 10px;
|
|
110
|
+
background: var(--tag-bg);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
.new-session-guide__item-title {
|
|
114
|
+
display: inline-flex;
|
|
115
|
+
align-items: center;
|
|
116
|
+
gap: 6px;
|
|
117
|
+
font-size: 13px;
|
|
118
|
+
font-weight: 600;
|
|
119
|
+
color: var(--text-color);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
.new-session-guide__item-icon {
|
|
123
|
+
font-size: 16px;
|
|
124
|
+
color: var(--sub-text-color);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
.new-session-guide__item-desc {
|
|
128
|
+
font-size: 12px;
|
|
129
|
+
color: var(--sub-text-color);
|
|
130
|
+
line-height: 1.4;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.new-session-guide__meta {
|
|
134
|
+
font-size: 11px;
|
|
135
|
+
color: var(--sub-text-color);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.new-session-guide__empty {
|
|
139
|
+
display: flex;
|
|
140
|
+
flex-direction: column;
|
|
141
|
+
gap: 12px;
|
|
142
|
+
align-items: flex-start;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.new-session-guide__empty-desc {
|
|
146
|
+
font-size: 12px;
|
|
147
|
+
color: var(--sub-text-color);
|
|
148
|
+
line-height: 1.4;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.new-session-guide__loading {
|
|
152
|
+
font-size: 12px;
|
|
153
|
+
color: var(--sub-text-color);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.new-session-guide__help {
|
|
157
|
+
display: flex;
|
|
158
|
+
flex-direction: column;
|
|
159
|
+
gap: 10px;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.new-session-guide__help-item {
|
|
163
|
+
display: flex;
|
|
164
|
+
align-items: flex-start;
|
|
165
|
+
gap: 8px;
|
|
166
|
+
font-size: 12px;
|
|
167
|
+
color: var(--sub-text-color);
|
|
168
|
+
line-height: 1.4;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
.new-session-guide__help-icon {
|
|
172
|
+
font-size: 14px;
|
|
173
|
+
margin-top: 2px;
|
|
174
|
+
color: var(--sub-text-color);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.new-session-guide__help-footer {
|
|
178
|
+
font-size: 12px;
|
|
179
|
+
color: var(--sub-text-color);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
@media (max-width: 1100px) {
|
|
183
|
+
.new-session-guide__grid {
|
|
184
|
+
grid-template-columns: 1fr;
|
|
185
|
+
}
|
|
186
|
+
}
|