Skip to content

Commit 003b911

Browse files
feat: paragraph
1 parent 1390ddb commit 003b911

File tree

12 files changed

+235
-122
lines changed

12 files changed

+235
-122
lines changed

ui/package.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,24 @@
1616
"@codemirror/lang-json": "^6.0.1",
1717
"@codemirror/lang-python": "^6.2.1",
1818
"@codemirror/theme-one-dark": "^6.1.2",
19+
"@vavt/cm-extension": "^1.9.1",
1920
"@wecom/jssdk": "^2.3.1",
2021
"axios": "^1.8.4",
22+
"cropperjs": "^2.0.0-rc.2",
2123
"dingtalk-jsapi": "^3.1.0",
2224
"element-plus": "^2.9.10",
25+
"highlight.js": "^11.11.1",
26+
"katex": "^0.16.22",
2327
"md-editor-v3": "^5.6.1",
28+
"mermaid": "^11.6.0",
2429
"nprogress": "^0.2.0",
2530
"pinia": "^3.0.1",
31+
"screenfull": "^6.0.2",
2632
"use-element-plus-theme": "^0.0.5",
2733
"vue": "^3.5.13",
2834
"vue-clipboard3": "^2.0.0",
2935
"vue-codemirror": "^6.1.1",
36+
"vue-draggable-plus": "^0.6.0",
3037
"vue-i18n": "^11.1.3",
3138
"vue-router": "^4.5.0"
3239
},

ui/src/assets/sort.svg

Lines changed: 1 addition & 0 deletions
Loading

ui/src/components/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import AutoTooltip from './auto-tooltip/index.vue'
1919
import MdEditor from './markdown/MdEditor.vue'
2020
import MdPreview from './markdown/MdPreview.vue'
2121
import MdEditorMagnify from './markdown/MdEditorMagnify.vue'
22+
import TagEllipsis from './tag-ellipsis/index.vue'
2223
export default {
2324
install(app: App) {
2425
app.component('LogoFull', LogoFull)
@@ -41,5 +42,6 @@ export default {
4142
app.component('MdPreview', MdPreview)
4243
app.component('MdEditor', MdEditor)
4344
app.component('MdEditorMagnify', MdEditorMagnify)
45+
app.component('TagEllipsis', TagEllipsis)
4446
},
4547
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<el-tag class="tag-ellipsis flex-between mb-8" effect="plain" v-bind="$attrs">
3+
<slot></slot>
4+
</el-tag>
5+
</template>
6+
<script setup lang="ts">
7+
defineOptions({ name: 'TagEllipsis' })
8+
</script>
9+
<style lang="scss" scoped>
10+
/* tag超出省略号 */
11+
.tag-ellipsis {
12+
border: 1px solid var(--el-border-color);
13+
color: var(--app-text-color);
14+
border-radius: 4px;
15+
height: 30px;
16+
line-height: 30px;
17+
padding: 0 9px;
18+
box-sizing: border-box;
19+
20+
:deep(.el-tag__content) {
21+
overflow: hidden;
22+
white-space: nowrap;
23+
text-overflow: ellipsis;
24+
}
25+
}
26+
</style>

ui/src/main.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import katex from 'katex'
1919
import 'katex/dist/katex.min.css'
2020

2121
import Cropper from 'cropperjs'
22-
import 'cropperjs/dist/cropper.css'
2322

2423
import mermaid from 'mermaid'
2524

ui/src/stores/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import useKnowledgeStore from './modules/knowledge'
77
import useModelStore from './modules/model'
88
import usePromptStore from './modules/prompt'
99
import useProblemStore from './modules/problem'
10+
import useParagraphStore from './modules/paragraph'
1011

1112
const useStore = () => ({
1213
common: useCommonStore(),
@@ -18,6 +19,7 @@ const useStore = () => ({
1819
model: useModelStore(),
1920
prompt: usePromptStore(),
2021
problem: useProblemStore(),
22+
paragraph: useParagraphStore(),
2123
})
2224

2325
export default useStore

ui/src/stores/modules/paragraph.ts

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import { defineStore } from 'pinia'
2+
import paragraphApi from '@/api/knowledge/paragraph'
3+
import type { Ref } from 'vue'
4+
5+
const useParagraphStore = defineStore('paragraph', {
6+
state: () => ({}),
7+
actions: {
8+
async asyncPutParagraph(
9+
datasetId: string,
10+
documentId: string,
11+
paragraphId: string,
12+
data: any,
13+
loading?: Ref<boolean>,
14+
) {
15+
return new Promise((resolve, reject) => {
16+
paragraphApi
17+
.putParagraph(datasetId, documentId, paragraphId, data, loading)
18+
.then((data) => {
19+
resolve(data)
20+
})
21+
.catch((error) => {
22+
reject(error)
23+
})
24+
})
25+
},
26+
27+
async asyncDelParagraph(
28+
datasetId: string,
29+
documentId: string,
30+
paragraphId: string,
31+
loading?: Ref<boolean>,
32+
) {
33+
return new Promise((resolve, reject) => {
34+
paragraphApi
35+
.delParagraph(datasetId, documentId, paragraphId, loading)
36+
.then((data) => {
37+
resolve(data)
38+
})
39+
.catch((error) => {
40+
reject(error)
41+
})
42+
})
43+
},
44+
},
45+
})
46+
47+
export default useParagraphStore

ui/src/styles/component.scss

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,25 @@
9999
padding: 0 !important;
100100
}
101101
}
102+
103+
// 分段 dialog
104+
.paragraph-dialog {
105+
padding: 0 !important;
106+
.el-scrollbar {
107+
height: auto !important;
108+
}
109+
.el-dialog__header {
110+
padding: 16px 24px;
111+
}
112+
.el-dialog__body {
113+
border-top: 1px solid var(--el-border-color);
114+
}
115+
.el-dialog__footer {
116+
padding: 16px 24px;
117+
border-top: 1px solid var(--el-border-color);
118+
}
119+
120+
.title {
121+
color: var(--app-text-color);
122+
}
123+
}

ui/src/styles/index.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
@use './variables.scss';
44
@use './app.scss';
55
@use './component.scss';
6+
@use './md-editor.scss';
67
@import 'nprogress/nprogress.css';
78
@import 'md-editor-v3/lib/style.css';
8-
@import './md-editor.scss';
9+

ui/src/views/application-overview/component/XPackDisplaySettingDialog.vue

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
<AppIcon
6060
:iconName="'app-magnify'"
6161
:style="{
62-
color: xpackForm.custom_theme?.header_font_color
62+
color: xpackForm.custom_theme?.header_font_color,
6363
}"
6464
style="font-size: 20px"
6565
></AppIcon>
@@ -69,7 +69,7 @@
6969
:size="20"
7070
class="color-secondary"
7171
:style="{
72-
color: xpackForm.custom_theme?.header_font_color
72+
color: xpackForm.custom_theme?.header_font_color,
7373
}"
7474
>
7575
<Close/>
@@ -305,15 +305,15 @@
305305
<el-option
306306
:label="
307307
$t(
308-
'views.applicationOverview.appInfo.SettingDisplayDialog.iconPosition.left'
308+
'views.applicationOverview.appInfo.SettingDisplayDialog.iconPosition.left',
309309
)
310310
"
311311
value="left"
312312
/>
313313
<el-option
314314
:label="
315315
$t(
316-
'views.applicationOverview.appInfo.SettingDisplayDialog.iconPosition.right'
316+
'views.applicationOverview.appInfo.SettingDisplayDialog.iconPosition.right',
317317
)
318318
"
319319
value="right"
@@ -337,15 +337,15 @@
337337
<el-option
338338
:label="
339339
$t(
340-
'views.applicationOverview.appInfo.SettingDisplayDialog.iconPosition.top'
340+
'views.applicationOverview.appInfo.SettingDisplayDialog.iconPosition.top',
341341
)
342342
"
343343
value="top"
344344
/>
345345
<el-option
346346
:label="
347347
$t(
348-
'views.applicationOverview.appInfo.SettingDisplayDialog.iconPosition.bottom'
348+
'views.applicationOverview.appInfo.SettingDisplayDialog.iconPosition.bottom',
349349
)
350350
"
351351
value="bottom"
@@ -453,14 +453,14 @@ const defaultSetting = {
453453
disclaimer_value: t('views.applicationOverview.appInfo.SettingDisplayDialog.disclaimerValue'),
454454
custom_theme: {
455455
theme_color: '',
456-
header_font_color: '#1f2329'
456+
header_font_color: '#1f2329',
457457
},
458458
float_location: {
459459
y: {type: 'bottom', value: 30},
460460
x: {type: 'right', value: 0}
461461
},
462462
show_avatar: true,
463-
show_user_avatar: false
463+
show_user_avatar: false,
464464
}
465465
466466
const displayFormRef = ref()
@@ -486,14 +486,14 @@ const xpackForm = ref<any>({
486486
disclaimer_value: t('views.applicationOverview.appInfo.SettingDisplayDialog.disclaimerValue'),
487487
custom_theme: {
488488
theme_color: '',
489-
header_font_color: '#1f2329'
489+
header_font_color: '#1f2329',
490490
},
491491
float_location: {
492492
y: {type: 'bottom', value: 30},
493493
x: {type: 'right', value: 0}
494494
},
495495
show_avatar: true,
496-
show_user_avatar: false
496+
show_user_avatar: false,
497497
})
498498
499499
const imgUrl = ref<any>({
@@ -512,7 +512,7 @@ const detail = ref<any>(null)
512512
const customStyle = computed(() => {
513513
return {
514514
background: xpackForm.value.custom_theme?.theme_color,
515-
color: xpackForm.value.custom_theme?.header_font_color
515+
color: xpackForm.value.custom_theme?.header_font_color,
516516
}
517517
})
518518
@@ -561,7 +561,7 @@ const open = (data: any, content: any) => {
561561
t('views.applicationOverview.appInfo.SettingDisplayDialog.disclaimerValue')
562562
) {
563563
xpackForm.value.disclaimer_value = t(
564-
'views.applicationOverview.appInfo.SettingDisplayDialog.disclaimerValue'
564+
'views.applicationOverview.appInfo.SettingDisplayDialog.disclaimerValue',
565565
)
566566
}
567567
xpackForm.value.avatar_url = data.avatar
@@ -573,7 +573,7 @@ const open = (data: any, content: any) => {
573573
xpackForm.value.show_user_avatar = data.show_user_avatar
574574
xpackForm.value.custom_theme = {
575575
theme_color: data.custom_theme?.theme_color || '',
576-
header_font_color: data.custom_theme?.header_font_color || '#1f2329'
576+
header_font_color: data.custom_theme?.header_font_color || '#1f2329',
577577
}
578578
xpackForm.value.float_location = data.float_location
579579
dialogVisible.value = true
@@ -613,7 +613,7 @@ defineExpose({open})
613613
</script>
614614
<style lang="scss">
615615
.setting-preview {
616-
background: #f5f6f7;
616+
background: var(--app-layout-bg-color);
617617
height: 570px;
618618
position: relative;
619619

0 commit comments

Comments
 (0)