Skip to content

Commit 91de185

Browse files
committed
fix bug
1 parent d4ff8ca commit 91de185

File tree

4 files changed

+295
-22
lines changed

4 files changed

+295
-22
lines changed

frontend/src/components/Bubble.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ const renderedContent = computed(() => {
2727
props.type === 'agent' && props.agentType === 'CoderAgent' ? 'bubble-coder' : '',
2828
props.type === 'agent' && props.agentType === 'WriterAgent' ? 'bubble-writer' : '',
2929
props.class
30-
]" style="display: flex;">
31-
<div class="flex flex-col items-center gap-1">
30+
]">
31+
<div class="flex flex-col gap-1">
3232
<!-- 头像在上方 -->
3333
<span v-if="props.type === 'user'" class="text-2xl select-none mb-1">🧑</span>
3434
<span v-else-if="props.type === 'agent' && props.agentType === 'CoderAgent'"
@@ -149,15 +149,17 @@ const renderedContent = computed(() => {
149149
@apply opacity-100;
150150
}
151151
152+
.bubble {
153+
display: flex;
154+
}
155+
152156
.bubble-user {
153157
justify-content: flex-end;
154-
/* 用户气泡整体靠右 */
155158
}
156159
157160
.bubble-coder,
158161
.bubble-writer {
159162
justify-content: flex-start;
160-
/* Agent 气泡整体靠左 */
161163
}
162164
163165
/* 用户气泡颜色 */

frontend/src/components/CoderEditor.vue

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ import {
1111
} from '@/components/ui/sidebar'
1212
import Files from '@/components/Files.vue'
1313
import NotebookArea from '@/components/NotebookArea.vue'
14+
import {
15+
ResizablePanelGroup,
16+
ResizablePanel,
17+
ResizableHandle,
18+
} from '@/components/ui/resizable'
1419
1520
1621
const isCollapsed = ref(false)
@@ -24,21 +29,24 @@ const handleCollapse = () => {
2429
</script>
2530
<template>
2631
<SidebarProvider :collapsed="isCollapsed">
27-
<div class="flex h-full min-h-0 w-full min-w-0">
28-
<div :class="[
29-
'transition-all duration-300 overflow-hidden',
30-
isCollapsed ? 'w-0' : 'w-44'
31-
]">
32-
<Files class="w-44 border-r h-full" />
33-
</div>
34-
<SidebarInset class="flex-1 flex flex-col min-h-0 min-w-0">
35-
<header class="flex h-10 shrink-0 items-center gap-2 border-b px-4">
36-
<SidebarTrigger class="-ml-1" @click="handleCollapse" />
37-
</header>
38-
<div class="flex-1 min-h-0 min-w-0 overflow-auto">
39-
<NotebookArea class="h-full min-w-0" />
40-
</div>
41-
</SidebarInset>
42-
</div>
32+
<ResizablePanelGroup direction="horizontal" class="h-full w-full min-w-0 min-h-0">
33+
<!-- 左侧 Files 面板 -->
34+
<ResizablePanel :default-size="20" :min-size="10" :max-size="40" class="h-full">
35+
<Files class="h-full border-r" />
36+
</ResizablePanel>
37+
<!-- 拖拽手柄 -->
38+
<ResizableHandle />
39+
<!-- 右侧 Notebook 面板 -->
40+
<ResizablePanel :default-size="80" :min-size="60" class="h-full">
41+
<SidebarInset class="flex-1 flex flex-col min-h-0 min-w-0 h-full">
42+
<header class="flex h-10 shrink-0 items-center gap-2 border-b px-4">
43+
<SidebarTrigger class="-ml-1" @click="handleCollapse" />
44+
</header>
45+
<div class="flex-1 min-h-0 min-w-0 overflow-auto">
46+
<NotebookArea class="h-full min-w-0" />
47+
</div>
48+
</SidebarInset>
49+
</ResizablePanel>
50+
</ResizablePanelGroup>
4351
</SidebarProvider>
4452
</template>

frontend/src/pages/task/index.vue

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import ChatArea from '@/components/ChatArea.vue'
2020
import { onMounted, ref, onBeforeUnmount, computed } from 'vue'
2121
import { TaskWebSocket } from '@/utils/websocket'
2222
import type { Message, CoderMessage, WriterMessage } from '@/utils/response'
23+
import messageData from '@/pages/test/message.json'
2324
2425
const props = defineProps<{ task_id: string }>()
2526
const messages = ref<Message[]>([])
@@ -38,6 +39,10 @@ onMounted(() => {
3839
messages.value.push(data)
3940
})
4041
ws.connect()
42+
43+
// TODO: 测试模式下加载
44+
// 本地加载 message.json
45+
messages.value = messageData as Message[]
4146
})
4247
4348
onBeforeUnmount(() => {
@@ -52,12 +57,12 @@ onBeforeUnmount(() => {
5257
const chatMessages = computed(() =>
5358
messages.value.filter(
5459
(msg) => {
55-
if (msg.msg_type === 'agent' && msg.agent_type === 'CoderAgent' && msg.code_result) {
60+
if (msg.msg_type === 'agent' && msg.agent_type === 'CoderAgent' && msg.content == null) {
5661
// 有 code_result 的 CoderAgent 消息不显示
5762
return false
5863
}
5964
// 其他 agent 或 system 消息正常显示
60-
return msg.msg_type === 'agent' || msg.msg_type === 'system'
65+
return msg.msg_type === 'agent' && msg.content || msg.msg_type === 'system'
6166
}
6267
)
6368
)
@@ -82,6 +87,16 @@ const writerMessages = computed(() =>
8287
)
8388
)
8489
90+
function downloadMessages() {
91+
const dataStr = "data:text/json;charset=utf-8," + encodeURIComponent(JSON.stringify(messages.value, null, 2))
92+
const downloadAnchorNode = document.createElement('a')
93+
downloadAnchorNode.setAttribute("href", dataStr)
94+
downloadAnchorNode.setAttribute("download", "message.json")
95+
document.body.appendChild(downloadAnchorNode)
96+
downloadAnchorNode.click()
97+
downloadAnchorNode.remove()
98+
}
99+
85100
</script>
86101

87102
<template>
@@ -123,4 +138,7 @@ const writerMessages = computed(() =>
123138
</div>
124139
</ResizablePanel>
125140
</ResizablePanelGroup>
141+
<button @click="downloadMessages" class="absolute top-2 right-2 z-10 bg-blue-500 text-white px-3 py-1 rounded">
142+
下载消息
143+
</button>
126144
</template>

0 commit comments

Comments
 (0)