Skip to content

Commit cdc03f4

Browse files
committed
update frontend
1 parent 31007b9 commit cdc03f4

File tree

9 files changed

+169
-144
lines changed

9 files changed

+169
-144
lines changed

frontend/src/components/AgentEditor/CoderEditor.vue

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
<script setup lang="ts">
22
import NotebookArea from '@/components/NotebookArea.vue'
3-
43
</script>
5-
<template>
6-
<NotebookArea class="h-full min-w-0 pb-4" />
74

5+
<template>
6+
<div class="h-full flex flex-col p-4">
7+
<div class="h-full bg-white rounded-lg border shadow-sm">
8+
<div class="border-b px-4 py-3">
9+
<h2 class="text-lg font-semibold text-gray-900">代码执行</h2>
10+
</div>
11+
<div class="h-full pb-14">
12+
<NotebookArea class="h-full" />
13+
</div>
14+
</div>
15+
</div>
816
</template>
917

1018
<style scoped>

frontend/src/components/AgentEditor/ModelerEditor.vue

Lines changed: 84 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script setup lang="ts">
22
import { computed } from 'vue'
33
import { useTaskStore } from '@/stores/task'
4-
import { Card, CardHeader, CardTitle, CardContent } from '@/components/ui/card'
54
import { Separator } from '@/components/ui/separator'
5+
import { ScrollArea } from '@/components/ui/scroll-area'
66
77
const taskStore = useTaskStore()
88
@@ -67,113 +67,117 @@ const questionsList = computed(() => {
6767
</script>
6868

6969
<template>
70-
<div class="h-full min-w-0 flex flex-col">
70+
<div class="h-full flex flex-col p-4">
7171
<!-- 上半部分:CoordinatorMessage 结构化信息 -->
72-
<div class="flex-1 p-4 overflow-auto">
73-
<Card class="h-full">
74-
<CardHeader>
75-
<CardTitle class="text-lg font-semibold">题目信息</CardTitle>
76-
</CardHeader>
77-
<CardContent class="space-y-4">
78-
<div v-if="coordinatorData">
79-
<!-- 题目标题 -->
80-
<div class="space-y-2">
81-
<h3 class="text-base font-medium text-gray-700">题目标题</h3>
82-
<div class="text-lg font-semibold text-gray-900">
83-
{{ coordinatorData.title }}
72+
<div class="h-1/2 mb-4 bg-white rounded-lg border shadow-sm">
73+
<div class="border-b px-4 py-3">
74+
<h2 class="text-lg font-semibold text-gray-900">题目信息</h2>
75+
</div>
76+
<div class="h-full pb-14">
77+
<ScrollArea class="h-full">
78+
<div class="p-4 space-y-4">
79+
<div v-if="coordinatorData">
80+
<!-- 题目标题 -->
81+
<div class="space-y-2">
82+
<h3 class="text-base font-medium text-gray-700">题目标题</h3>
83+
<div class="text-lg font-semibold text-gray-900">
84+
{{ coordinatorData.title }}
85+
</div>
8486
</div>
85-
</div>
8687

87-
<Separator />
88+
<Separator />
8889

89-
<!-- 题目背景 -->
90-
<div class="space-y-2">
91-
<h3 class="text-base font-medium text-gray-700">题目背景</h3>
92-
<div class="text-sm text-gray-800 leading-relaxed whitespace-pre-wrap">
93-
{{ coordinatorData.background }}
90+
<!-- 题目背景 -->
91+
<div class="space-y-2">
92+
<h3 class="text-base font-medium text-gray-700">题目背景</h3>
93+
<div class="text-sm text-gray-800 leading-relaxed whitespace-pre-wrap">
94+
{{ coordinatorData.background }}
95+
</div>
9496
</div>
95-
</div>
9697

97-
<Separator />
98+
<Separator />
9899

99-
<!-- 问题数量和问题列表 -->
100-
<div class="space-y-2">
101-
<div class="flex items-center gap-2">
102-
<h3 class="text-base font-medium text-gray-700">问题列表</h3>
103-
<span class="px-2 py-1 text-xs bg-gray-100 rounded">{{ coordinatorData.ques_count }} 个问题</span>
104-
</div>
100+
<!-- 问题数量和问题列表 -->
101+
<div class="space-y-2">
102+
<div class="flex items-center gap-2">
103+
<h3 class="text-base font-medium text-gray-700">问题列表</h3>
104+
<span class="px-2 py-1 text-xs bg-gray-100 rounded">{{ coordinatorData.ques_count }} 个问题</span>
105+
</div>
105106

106-
<div class="space-y-3">
107-
<div v-for="question in questionsList" :key="question.number"
108-
class="border-l-4 border-blue-500 pl-4 py-2 bg-blue-50 rounded-r">
109-
<div class="text-sm font-medium text-blue-700 mb-1">
110-
问题 {{ question.number }}
111-
</div>
112-
<div class="text-sm text-gray-800 leading-relaxed">
113-
{{ question.content }}
107+
<div class="space-y-3">
108+
<div v-for="question in questionsList" :key="question.number"
109+
class="border-l-4 border-blue-500 pl-4 py-2 bg-blue-50 rounded-r">
110+
<div class="text-sm font-medium text-blue-700 mb-1">
111+
问题 {{ question.number }}
112+
</div>
113+
<div class="text-sm text-gray-800 leading-relaxed">
114+
{{ question.content }}
115+
</div>
114116
</div>
115117
</div>
116118
</div>
117119
</div>
118-
</div>
119120

120-
<div v-else class="text-center py-8 text-gray-500">
121-
暂无题目信息
121+
<div v-else class="flex items-center justify-center h-32 text-gray-500">
122+
暂无题目信息
123+
</div>
122124
</div>
123-
</CardContent>
124-
</Card>
125+
</ScrollArea>
126+
</div>
125127
</div>
126128

127129
<!-- 下半部分:ModelerMessage 建模手册 -->
128-
<div class="flex-1 p-4 pt-0 overflow-auto">
129-
<Card class="h-full">
130-
<CardHeader>
131-
<CardTitle class="text-lg font-semibold">建模手册</CardTitle>
132-
</CardHeader>
133-
<CardContent>
134-
<div v-if="modelerData" class="space-y-4">
135-
<!-- EDA部分 -->
136-
<div v-if="modelerData.eda" class="space-y-2">
137-
<h3 class="text-base font-medium text-gray-700 flex items-center gap-2">
138-
<span class="px-2 py-1 text-xs bg-gray-200 border rounded">EDA</span>
139-
探索性数据分析
140-
</h3>
141-
<div class="text-sm text-gray-800 leading-relaxed whitespace-pre-wrap bg-gray-50 p-3 rounded">
142-
{{ modelerData.eda }}
130+
<div class="h-1/2 bg-white rounded-lg border shadow-sm">
131+
<div class="border-b px-4 py-3">
132+
<h2 class="text-lg font-semibold text-gray-900">建模手册</h2>
133+
</div>
134+
<div class="h-full pb-14">
135+
<ScrollArea class="h-full">
136+
<div class="p-4">
137+
<div v-if="modelerData" class="space-y-4">
138+
<!-- EDA部分 -->
139+
<div v-if="modelerData.eda" class="space-y-2">
140+
<h3 class="text-base font-medium text-gray-700 flex items-center gap-2">
141+
<span class="px-2 py-1 text-xs bg-gray-200 border rounded">EDA</span>
142+
探索性数据分析
143+
</h3>
144+
<div class="text-sm text-gray-800 leading-relaxed whitespace-pre-wrap bg-gray-50 p-3 rounded">
145+
{{ modelerData.eda }}
146+
</div>
147+
</div>
148+
149+
<!-- 问题解决方案 -->
150+
<div v-for="question in questionsList" :key="`solution-${question.number}`" class="space-y-2">
151+
<div v-if="modelerData[`ques${question.number}`]">
152+
<h3 class="text-base font-medium text-gray-700 flex items-center gap-2">
153+
<span class="px-2 py-1 text-xs bg-gray-200 border rounded">问题{{ question.number }}</span>
154+
解决方案
155+
</h3>
156+
<div
157+
class="text-sm text-gray-800 leading-relaxed whitespace-pre-wrap bg-green-50 p-3 rounded border-l-4 border-green-500">
158+
{{ modelerData[`ques${question.number}`] }}
159+
</div>
160+
</div>
143161
</div>
144-
</div>
145162

146-
<!-- 问题解决方案 -->
147-
<div v-for="question in questionsList" :key="`solution-${question.number}`" class="space-y-2">
148-
<div v-if="modelerData[`ques${question.number}`]">
163+
<!-- 敏感性分析 -->
164+
<div v-if="modelerData.sensitivity_analysis" class="space-y-2">
149165
<h3 class="text-base font-medium text-gray-700 flex items-center gap-2">
150-
<span class="px-2 py-1 text-xs bg-gray-200 border rounded">问题{{ question.number }}</span>
151-
解决方案
166+
<span class="px-2 py-1 text-xs bg-gray-200 border rounded">敏感性分析</span>
152167
</h3>
153168
<div
154-
class="text-sm text-gray-800 leading-relaxed whitespace-pre-wrap bg-green-50 p-3 rounded border-l-4 border-green-500">
155-
{{ modelerData[`ques${question.number}`] }}
169+
class="text-sm text-gray-800 leading-relaxed whitespace-pre-wrap bg-orange-50 p-3 rounded border-l-4 border-orange-500">
170+
{{ modelerData.sensitivity_analysis }}
156171
</div>
157172
</div>
158173
</div>
159174

160-
<!-- 敏感性分析 -->
161-
<div v-if="modelerData.sensitivity_analysis" class="space-y-2">
162-
<h3 class="text-base font-medium text-gray-700 flex items-center gap-2">
163-
<span class="px-2 py-1 text-xs bg-gray-200 border rounded">敏感性分析</span>
164-
</h3>
165-
<div
166-
class="text-sm text-gray-800 leading-relaxed whitespace-pre-wrap bg-orange-50 p-3 rounded border-l-4 border-orange-500">
167-
{{ modelerData.sensitivity_analysis }}
168-
</div>
175+
<div v-else class="flex items-center justify-center h-32 text-gray-500">
176+
暂无建模手册信息
169177
</div>
170178
</div>
171-
172-
<div v-else class="text-center py-8 text-gray-500">
173-
暂无建模手册信息
174-
</div>
175-
</CardContent>
176-
</Card>
179+
</ScrollArea>
180+
</div>
177181
</div>
178182
</div>
179183
</template>

frontend/src/components/AgentEditor/WriterEditor.vue

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ const props = defineProps<{
1616
writerSequence: string[]
1717
}>()
1818
19-
20-
2119
const sections = ref<ContentSection[]>([]);
2220
let nextId = 0;
2321
@@ -64,18 +62,29 @@ watch(() => props.messages, async (messages) => {
6462
</script>
6563

6664
<template>
67-
<ScrollArea class="h-full overflow-y-auto p-6">
68-
<div class="max-w-4xl mx-auto overflow-y-auto space-y-6">
69-
<TransitionGroup name="section" tag="div" class="space-y-6">
70-
<div v-for="section in sortedSections" :key="section.id"
71-
class="bg-white rounded-lg shadow-lg transform transition-all duration-500">
65+
<div class="h-full flex flex-col p-4">
66+
<div class="h-full bg-white rounded-lg border shadow-sm">
67+
<div class="border-b px-4 py-3">
68+
<h2 class="text-lg font-semibold text-gray-900">论文内容</h2>
69+
</div>
70+
<div class="h-full pb-14">
71+
<ScrollArea class="h-full overflow-y-auto">
7272
<div class="p-6">
73-
<div class="prose prose-slate max-w-none" v-html="section.renderedContent"></div>
73+
<div class="max-w-4xl mx-auto overflow-y-auto space-y-6">
74+
<TransitionGroup name="section" tag="div" class="space-y-6">
75+
<div v-for="section in sortedSections" :key="section.id"
76+
class="bg-gray-50 rounded-lg shadow-sm transform transition-all duration-500">
77+
<div class="p-6">
78+
<div class="prose prose-slate max-w-none" v-html="section.renderedContent"></div>
79+
</div>
80+
</div>
81+
</TransitionGroup>
82+
</div>
7483
</div>
75-
</div>
76-
</TransitionGroup>
84+
</ScrollArea>
85+
</div>
7786
</div>
78-
</ScrollArea>
87+
</div>
7988
</template>
8089

8190
<style>

frontend/src/components/ChatArea.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const sendMessage = () => {
3131
<Bubble v-if="message.msg_type === 'user'" type="user" :content="message.content || ''" />
3232
<!-- agent 消息(CoderAgent/WriterAgent,只显示 content) -->
3333
<Bubble v-else-if="message.msg_type === 'agent'" type="agent" :agentType="message.agent_type"
34-
:content="message.content || ''" />
34+
:content="message.content" />
3535
<!-- 系统消息 -->
3636
<SystemMessage v-else-if="message.msg_type === 'system'" :content="message.content || ''"
3737
:type="message.type" />

frontend/src/components/NotebookArea.vue

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,29 @@ import type { NoteCell, CodeCell, ResultCell } from '@/utils/interface'
66
77
// 使用任务存储
88
const taskStore = useTaskStore()
9-
9+
console.log('interpreterMessage:', taskStore.interpreterMessage)
1010
// 将代码消息转换为Notebook单元格
1111
const cells = computed<NoteCell[]>(() => {
1212
const notebookCells: NoteCell[] = []
1313
14-
// 筛选出CoderAgent消息
15-
for (const msg of taskStore.coderMessages) {
16-
console.log('Coder message:', msg)
17-
// 处理代码和执行结果
18-
if (msg.code) {
19-
// 添加代码单元格
14+
// 获取代码执行工具消息,按顺序处理
15+
for (const toolMsg of taskStore.interpreterMessage) {
16+
console.log('Code execute message:', toolMsg)
17+
18+
// 处理代码输入消息
19+
if (toolMsg.input && toolMsg.input.code) {
2020
const codeCell: CodeCell = {
2121
type: 'code',
22-
content: msg.code
22+
content: toolMsg.input.code
2323
}
2424
notebookCells.push(codeCell)
25-
2625
}
2726
28-
// 如果有执行结果,添加结果单元格
29-
if (msg.code_results && msg.code_results.length > 0) {
27+
// 处理执行结果消息
28+
if (toolMsg.output && toolMsg.output.length > 0) {
3029
const resultCell: ResultCell = {
3130
type: 'result',
32-
code_results: msg.code_results
31+
code_results: toolMsg.output
3332
}
3433
notebookCells.push(resultCell)
3534
}
@@ -42,14 +41,13 @@ const cells = computed<NoteCell[]>(() => {
4241
<template>
4342
<div class="flex-1 px-1 pt-1 pb-4 h-full overflow-y-auto">
4443
<!-- 遍历所有单元格 -->
45-
<div v-for="(cell, index) in cells" :key="index"
46-
:class="[
47-
'transform transition-all duration-200 hover:shadow-lg',
48-
cell.type === 'code' ? 'pt-2' : 'pt-0'
49-
]">
44+
<div v-for="(cell, index) in cells" :key="index" :class="[
45+
'transform transition-all duration-200 hover:shadow-lg',
46+
cell.type === 'code' ? 'pt-2' : 'pt-0'
47+
]">
5048
<NotebookCell :cell="cell" />
5149
</div>
52-
50+
5351
<!-- 无内容时的提示 -->
5452
<div v-if="cells.length === 0" class="flex items-center justify-center h-full">
5553
<div class="text-gray-400 text-center p-8">

frontend/src/pages/task/index.vue

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -93,28 +93,16 @@ onBeforeUnmount(() => {
9393

9494
</div>
9595

96-
<TabsContent value="modeler" class="h-full p-1 flex-1 overflow-auto">
97-
<Card class="h-full m-2">
98-
<CardContent class="h-full p-1">
99-
<ModelerEditor />
100-
</CardContent>
101-
</Card>
96+
<TabsContent value="modeler" class="flex-1 p-1 min-w-0 h-full overflow-hidden">
97+
<ModelerEditor />
10298
</TabsContent>
10399

104-
<TabsContent value="coder" class="h-full p-1 flex-1 overflow-auto">
105-
<Card class="h-full m-2">
106-
<CardContent class="h-full p-1">
107-
<CoderEditor />
108-
</CardContent>
109-
</Card>
100+
<TabsContent value="coder" class="flex-1 p-1 min-w-0 h-full overflow-hidden">
101+
<CoderEditor />
110102
</TabsContent>
111103

112-
<TabsContent value="writer" class="flex-1 p-1 min-w-0 h-full overflow-auto">
113-
<Card class="min-w-0 rounded-lg">
114-
<CardContent class="p-2 h-full min-w-0 overflow-auto">
115-
<WriterEditor :messages="taskStore.writerMessages" :writerSequence="writerSequence" />
116-
</CardContent>
117-
</Card>
104+
<TabsContent value="writer" class="flex-1 p-1 min-w-0 h-full overflow-hidden">
105+
<WriterEditor :messages="taskStore.writerMessages" :writerSequence="writerSequence" />
118106
</TabsContent>
119107
</Tabs>
120108
</div>

0 commit comments

Comments
 (0)