@@ -3,7 +3,6 @@ import { onMounted, ref, watch, computed } from 'vue';
33import { renderMarkdown } from ' @/utils/markdown' ;
44import type { WriterMessage } from ' @/utils/response'
55import { ScrollArea } from ' @/components/ui/scroll-area'
6- import { getWriterSeque } from ' @/apis/commonApi' ;
76
87interface ContentSection {
98 id: number ;
@@ -14,14 +13,10 @@ interface ContentSection {
1413
1514const props = defineProps <{
1615 messages: WriterMessage []
16+ writerSequence: string []
1717}>()
1818
19- const writerSequence = ref <string []>([]);
2019
21- onMounted (async () => {
22- const res = await getWriterSeque ();
23- writerSequence .value = Array .isArray (res .data ) ? res .data : [];
24- });
2520
2621const sections = ref <ContentSection []>([]);
2722let nextId = 0 ;
@@ -39,11 +34,11 @@ const appendContent = async (content: string, sub_title?: string) => {
3934
4035// 根据 writerSequence 排序内容
4136const sortedSections = computed (() => {
42- if (! writerSequence . value .length ) return sections .value ;
37+ if (! props . writerSequence .length ) return sections .value ;
4338
4439 return [... sections .value ].sort ((a , b ) => {
45- const aIndex = a .sub_title ? writerSequence . value .indexOf (a .sub_title ) : Infinity ;
46- const bIndex = b .sub_title ? writerSequence . value .indexOf (b .sub_title ) : Infinity ;
40+ const aIndex = a .sub_title ? props . writerSequence .indexOf (a .sub_title ) : Infinity ;
41+ const bIndex = b .sub_title ? props . writerSequence .indexOf (b .sub_title ) : Infinity ;
4742
4843 if (aIndex === Infinity && bIndex === Infinity ) return 0 ;
4944 if (aIndex === Infinity ) return 1 ;
@@ -73,7 +68,7 @@ watch(() => props.messages, async (messages) => {
7368 <div class =" max-w-4xl mx-auto overflow-y-auto space-y-6" >
7469 <TransitionGroup name =" section" tag =" div" class =" space-y-6" >
7570 <div v-for =" section in sortedSections" :key =" section.id"
76- class =" bg-white rounded-lg shadow-lg overflow-hidden transform transition-all duration-500" >
71+ class =" bg-white rounded-lg shadow-lg transform transition-all duration-500" >
7772 <div class =" p-6" >
7873 <div class =" prose prose-slate max-w-none" v-html =" section.renderedContent" ></div >
7974 </div >
@@ -142,16 +137,16 @@ watch(() => props.messages, async (messages) => {
142137}
143138
144139.prose table {
145- @apply w-full border-collapse border border-gray- 300 my- 4 ;
140+ @apply w-full border-collapse border border-gray- 800 ;
146141}
147142
148143.prose th ,
149144.prose td {
150- @apply border border-gray- 300 p- 2 ;
145+ @apply border border-gray- 800 p- 1 text-center ;
151146}
152147
153- .prose thead {
154- @apply bg- gray-50 ;
148+ .prose th {
149+ @apply font-bold text- gray-900 text-center ;
155150}
156151
157152.prose code {
0 commit comments