Skip to content

Commit 4437361

Browse files
feat: style
1 parent f83336d commit 4437361

File tree

30 files changed

+566
-521
lines changed

30 files changed

+566
-521
lines changed

apps/chat/template/embed.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,8 +240,8 @@ function initMaxkbStyle(root, maxkbId){
240240
241241
}
242242
#maxkb-chat-container {
243-
width: 450px;
244-
height: 600px;
243+
width: 460px;
244+
height: 680px;
245245
display:none;
246246
}
247247
@media only screen and (max-width: 768px) {

ui/src/api/application/application-xpack.ts

Lines changed: 0 additions & 48 deletions
This file was deleted.

ui/src/api/application/application.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,27 @@ const putAccessToken: (
120120
return put(`${prefix.value}/${application_id}/access_token`, data, undefined, loading)
121121
}
122122

123+
/**
124+
* 替换社区版-修改AccessToken
125+
* @param 参数 application_id
126+
* data {
127+
* "show_source": boolean,
128+
* "show_history": boolean,
129+
* "draggable": boolean,
130+
* "show_guide": boolean,
131+
* "avatar": file,
132+
* "float_icon": file,
133+
* }
134+
*/
135+
const putXpackAccessToken: (
136+
application_id: string,
137+
data: any,
138+
loading?: Ref<boolean>,
139+
) => Promise<Result<any>> = (application_id, data, loading) => {
140+
return put(`${prefix.value}/${application_id}/setting`, data, undefined, loading)
141+
}
142+
143+
123144
/**
124145
* 导出应用
125146
*/
@@ -331,6 +352,7 @@ export default {
331352
getApplicationDetail,
332353
getAccessToken,
333354
putAccessToken,
355+
putXpackAccessToken,
334356
exportApplication,
335357
importApplication,
336358
getStatistics,

ui/src/components/ai-chat/component/answer-content/index.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<!-- 知识来源 -->
4343
<KnowledgeSourceComponent
4444
:data="chatRecord"
45+
:application="application"
4546
:type="application.type"
4647
:executionIsRightPanel="props.executionIsRightPanel"
4748
@open-execution-detail="emit('openExecutionDetail')"
@@ -90,8 +91,6 @@ const props = defineProps<{
9091
executionIsRightPanel?: boolean
9192
}>()
9293
93-
const { user } = useStore()
94-
9594
const emit = defineEmits([
9695
'update:chatRecord',
9796
'openExecutionDetail',
@@ -100,10 +99,10 @@ const emit = defineEmits([
10099
])
101100
102101
const showAvatar = computed(() => {
103-
return user.isEE() || user.isPE() ? props.application.show_avatar : true
102+
return props.application.show_avatar == undefined ? true : props.application.show_avatar
104103
})
105104
const showUserAvatar = computed(() => {
106-
return user.isEE() || user.isPE() ? props.application.show_user_avatar : true
105+
return props.application.show_user_avatar == undefined ? true : props.application.show_user_avatar
107106
})
108107
const chatMessage = (question: string, type: 'old' | 'new', other_params_data?: any) => {
109108
if (type === 'old') {
@@ -150,7 +149,11 @@ function showSource(row: any) {
150149
if (props.type === 'log') {
151150
return true
152151
} else if (row.write_ed && 500 !== row.status) {
153-
if (props.type === 'debug-ai-chat' || props.application?.show_source) {
152+
if (
153+
props.type === 'debug-ai-chat' ||
154+
props.application?.show_source ||
155+
props.application?.show_exec
156+
) {
154157
return true
155158
}
156159
}

ui/src/components/ai-chat/component/knowledge-source-component/ExecutionDetailContent.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@
193193
>
194194
<div class="card-never border-r-6" v-if="item.type !== WorkflowType.Application">
195195
<h5 class="p-8-12">
196-
{{ $t('views.application.applicationForm.form.roleSettings.label') }}
196+
{{ $t('views.application.form.roleSettings.label') }}
197197
</h5>
198198
<div class="p-8-12 border-t-dashed lighter">
199199
{{ item.system || '-' }}
@@ -503,7 +503,7 @@
503503
<template v-if="item.type == WorkflowType.ImageUnderstandNode">
504504
<div class="card-never border-r-6" v-if="item.type !== WorkflowType.Application">
505505
<h5 class="p-8-12">
506-
{{ $t('views.application.applicationForm.form.roleSettings.label') }}
506+
{{ $t('views.application.form.roleSettings.label') }}
507507
</h5>
508508
<div class="p-8-12 border-t-dashed lighter">
509509
{{ item.system || '-' }}

ui/src/components/ai-chat/component/knowledge-source-component/ParagraphSourceContent.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<ParagraphCard :data="item" :content="item.content" :index="index" />
77
</template>
88
</div>
9-
<span v-else> - </span>
9+
<span v-else> {{ $t('chat.KnowledgeSource.noSource') }}</span>
1010
</div>
1111
</el-scrollbar>
1212
</template>

ui/src/components/ai-chat/component/knowledge-source-component/index.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
22
<div class="chat-knowledge-source">
3-
<div class="flex align-center mt-16">
3+
<div class="flex align-center mt-16" v-if="application.show_source">
44
<span class="mr-4 color-secondary">{{ $t('chat.KnowledgeSource.title') }}</span>
55
<el-divider direction="vertical" />
66
<el-button type="primary" class="mr-8" link @click="openParagraph(data)">
@@ -9,7 +9,7 @@
99
{{ data.paragraph_list?.length || 0 }}</el-button
1010
>
1111
</div>
12-
<div class="mt-8">
12+
<div class="mt-8" v-if="application.show_source">
1313
<el-row :gutter="8" v-if="uniqueParagraphList?.length">
1414
<template v-for="(item, index) in uniqueParagraphList" :key="index">
1515
<el-col :span="12" class="mb-8">
@@ -44,6 +44,7 @@
4444
</div>
4545

4646
<div
47+
v-if="application.show_exec"
4748
class="execution-details border-t color-secondary flex-between mt-12"
4849
style="padding-top: 12px; padding-bottom: 8px"
4950
>
@@ -104,6 +105,10 @@ const props = defineProps({
104105
type: Boolean,
105106
required: false,
106107
},
108+
application: {
109+
type: Object,
110+
default: () => {},
111+
},
107112
})
108113
109114
const emit = defineEmits(['openExecutionDetail', 'openParagraph', 'openParagraphDocument'])

ui/src/components/ai-chat/component/prologue-content/index.vue

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class="content"
1010
v-if="prologue"
1111
:style="{
12-
'padding-right': showUserAvatar ? 'var(--padding-left)' : '0'
12+
'padding-right': showUserAvatar ? 'var(--padding-left)' : '0',
1313
}"
1414
>
1515
<el-card shadow="always" class="border-r-8" style="--el-card-padding: 10px 16px 12px">
@@ -35,13 +35,12 @@ const props = defineProps<{
3535
sendMessage: (question: string, other_params_data?: any, chat?: chatType) => void
3636
}>()
3737
38-
const { user } = useStore()
3938
4039
const showAvatar = computed(() => {
41-
return (user.isEE() || user.isPE()) ? props.application.show_avatar : true
40+
return props.application.show_avatar == undefined ? true : props.application.show_avatar
4241
})
4342
const showUserAvatar = computed(() => {
44-
return user.isEE() || user.isPE() ? props.application.show_user_avatar : true
43+
return props.application.show_user_avatar == undefined ? true : props.application.show_user_avatar
4544
})
4645
4746
const toQuickQuestion = (match: string, offset: number, input: string) => {
@@ -54,7 +53,7 @@ const prologue = computed(() => {
5453
/<html_rander>[\d\D]*?<\/html_rander>/g,
5554
/<echarts_rander>[\d\D]*?<\/echarts_rander>/g,
5655
/<quick_question>[\d\D]*?<\/quick_question>/g,
57-
/<form_rander>[\d\D]*?<\/form_rander>/g
56+
/<form_rander>[\d\D]*?<\/form_rander>/g,
5857
]
5958
let _temp = temp
6059
for (const index in tag_list) {

ui/src/components/ai-chat/component/question-content/index.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,10 +106,8 @@ const props = defineProps<{
106106
type: 'log' | 'ai-chat' | 'debug-ai-chat'
107107
}>()
108108
109-
const { user } = useStore()
110-
111109
const showAvatar = computed(() => {
112-
return user.isEE() || user.isPE() ? props.application.show_user_avatar : true
110+
return props.application.show_avatar == undefined ? true : props.application.show_avatar
113111
})
114112
115113
const document_list = computed(() => {

ui/src/components/ai-chat/index.vue

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,9 @@
8686
@click="toggleUserInput"
8787
>
8888
<el-icon :size="16" class="mr-4"><EditPen /></el-icon>
89-
{{ $t('chat.userInput') }}
89+
<span class="ellipsis">
90+
{{ userInputTitle || $t('chat.userInput') }}
91+
</span>
9092
</el-button>
9193
</template>
9294
</ChatInputOperate>
@@ -171,6 +173,12 @@ const isUserInput = computed(
171173
props.applicationDetails.work_flow?.nodes?.filter((v: any) => v.id === 'base-node')[0]
172174
.properties.user_input_field_list.length > 0,
173175
)
176+
177+
const userInputTitle = computed(
178+
() =>
179+
props.applicationDetails.work_flow?.nodes?.filter((v: any) => v.id === 'base-node')[0]
180+
.properties?.user_input_config?.title,
181+
)
174182
const isAPIInput = computed(
175183
() =>
176184
props.type === 'debug-ai-chat' &&
@@ -543,7 +551,7 @@ function chatMessage(chat?: any, problem?: string, re_chat?: boolean, other_para
543551
if (props.chatId === 'new') {
544552
emit('refresh', chartOpenId.value)
545553
}
546-
return (id || props.applicationDetails?.show_source) && getSourceDetail(chat)
554+
return (id || props.applicationDetails?.show_source || props.applicationDetails?.show_exec) && getSourceDetail(chat)
547555
})
548556
.finally(() => {
549557
ChatManagement.close(chat.id)

0 commit comments

Comments
 (0)