Skip to content

Commit 764de6e

Browse files
authored
Merge branch 'v2' into pr@v2@fix_chat
2 parents 66e180a + a0bca36 commit 764de6e

File tree

33 files changed

+297
-252
lines changed

33 files changed

+297
-252
lines changed

apps/users/serializers/user.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def profile(user: User, auth: Auth):
110110
'email': user.email,
111111
'role': auth.role_list,
112112
'permissions': auth.permission_list,
113-
'is_edit_password': user.role == RoleConstants.ADMIN.name and user.password == 'd880e722c47a34d8e9fce789fc62389d',
113+
'is_edit_password': user.password == 'd880e722c47a34d8e9fce789fc62389d' if user.source == 'LOCAL' else False,
114114
'language': user.language,
115115
'workspace_list': workspace_list,
116116
'role_name': role_name

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@
733733
</div>
734734
<div v-if="system" class="card-never border-r-6 mb-12">
735735
<h5 class="p-8-12">
736-
{{ $t('chat.paragraphSource.system') }}
736+
{{ $t('views.application.form.roleSettings.label') }}
737737
</h5>
738738
<div class="p-8-12 border-t-dashed lighter">
739739
<span class="mb-8">{{ system }}</span>
@@ -742,7 +742,7 @@
742742

743743
<div class="card-never border-r-6 mb-12">
744744
<h5 class="p-8-12">
745-
{{ $t('chat.paragraphSource.historyRecord') }}
745+
{{ $t('chat.history') }}
746746
</h5>
747747
<div class="p-8-12 border-t-dashed lighter">
748748
<div v-for="(msg, index) in historyRecord" :key="index">
@@ -754,10 +754,10 @@
754754

755755
<div class="card-never border-r-6 mb-12">
756756
<h5 class="p-8-12">
757-
{{ $t('chat.paragraphSource.currentChat') }}
757+
{{ $t('chat.executionDetails.currentChat') }}
758758
</h5>
759759
<div class="p-8-12 border-t-dashed lighter">
760-
<div class="mb-8">{{ $t('chat.paragraphSource.knowedMessage') }}:</div>
760+
<div class="mb-8">{{ $t('chat.executionDetails.knowedMessage') }}:</div>
761761
<div v-for="(msg, index) in currentChat" :key="index">
762762
<span>{{ msg.content }}</span>
763763
</div>
@@ -766,7 +766,7 @@
766766

767767
<div class="card-never border-r-6 mb-12">
768768
<h5 class="p-8-12">
769-
{{ $t('chat.paragraphSource.AiResponse') }}
769+
{{ $t('chat.executionDetails.answer') }}
770770
</h5>
771771
<div class="p-8-12 border-t-dashed lighter">
772772
<div v-for="(msg, index) in AiResponse" :key="index">

ui/src/components/app-icon/icons/knowledge.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,4 +106,46 @@ export default {
106106
])
107107
},
108108
},
109+
'app-drag-outlined': {
110+
iconReader: () => {
111+
return h('i', [
112+
h(
113+
'svg',
114+
{
115+
style: { height: '100%', width: '100%' },
116+
viewBox: '0 0 1024 1024',
117+
version: '1.1',
118+
xmlns: 'http://www.w3.org/2000/svg',
119+
},
120+
[
121+
h('path', {
122+
d: 'M682.666667 746.666667a21.333333 21.333333 0 0 1 21.333333 21.333333v85.333333a21.248 21.248 0 0 1-21.333333 21.333334h-85.333334a21.248 21.248 0 0 1-21.333333-21.333334v-85.333333a21.248 21.248 0 0 1 21.333333-21.333333h85.333334z m-256 0a21.333333 21.333333 0 0 1 21.333333 21.333333v85.333333a21.248 21.248 0 0 1-21.333333 21.333334H341.333333a21.290667 21.290667 0 0 1-21.333333-21.333334v-85.333333a21.333333 21.333333 0 0 1 21.333333-21.333333h85.333334z m170.666666-298.666667h85.333334a21.333333 21.333333 0 0 1 21.333333 21.333333v85.333334a21.248 21.248 0 0 1-21.333333 21.333333h-85.333334a21.248 21.248 0 0 1-21.333333-21.333333v-85.333334a21.248 21.248 0 0 1 21.333333-21.333333z m-256 0h85.333334a21.333333 21.333333 0 0 1 21.333333 21.333333v85.333334a21.248 21.248 0 0 1-21.333333 21.333333H341.333333a21.290667 21.290667 0 0 1-21.333333-21.333333v-85.333334a21.333333 21.333333 0 0 1 21.333333-21.333333z m341.333334-298.666667a21.333333 21.333333 0 0 1 21.333333 21.333334v85.333333a21.333333 21.333333 0 0 1-21.333333 21.333333h-85.333334a21.333333 21.333333 0 0 1-21.333333-21.333333V170.666667a21.290667 21.290667 0 0 1 21.333333-21.333334h85.333334z m-256 0a21.333333 21.333333 0 0 1 21.333333 21.333334v85.333333a21.333333 21.333333 0 0 1-21.333333 21.333333H341.333333a21.333333 21.333333 0 0 1-21.333333-21.333333V170.666667a21.333333 21.333333 0 0 1 21.333333-21.333334h85.333334z',
123+
fill: 'currentColor',
124+
}),
125+
],
126+
),
127+
])
128+
},
129+
},
130+
'app-add-circle-outlined': {
131+
iconReader: () => {
132+
return h('i', [
133+
h(
134+
'svg',
135+
{
136+
style: { height: '100%', width: '100%' },
137+
viewBox: '0 0 1024 1024',
138+
version: '1.1',
139+
xmlns: 'http://www.w3.org/2000/svg',
140+
},
141+
[
142+
h('path', {
143+
d: 'M469.333333 469.333333V320a21.333333 21.333333 0 0 1 21.333334-21.333333h42.666666a21.333333 21.333333 0 0 1 21.333334 21.333333V469.333333h149.333333a21.333333 21.333333 0 0 1 21.333333 21.333334v42.666666a21.333333 21.333333 0 0 1-21.333333 21.333334H554.666667v149.333333a21.333333 21.333333 0 0 1-21.333334 21.333333h-42.666666a21.333333 21.333333 0 0 1-21.333334-21.333333V554.666667H320a21.333333 21.333333 0 0 1-21.333333-21.333334v-42.666666a21.333333 21.333333 0 0 1 21.333333-21.333334H469.333333z m42.666667 426.666667a384 384 0 1 0 0-768 384 384 0 0 0 0 768z m0 85.333333C252.8 981.333333 42.666667 771.2 42.666667 512S252.8 42.666667 512 42.666667s469.333333 210.133333 469.333333 469.333333-210.133333 469.333333-469.333333 469.333333z',
144+
fill: 'currentColor',
145+
}),
146+
],
147+
),
148+
])
149+
},
150+
},
109151
}

ui/src/components/markdown/MdRenderer.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
@click="
99
sendMessage && type !== 'log' ? sendMessage(item.content, 'new') : (content: string) => {}
1010
"
11-
class="problem-button mt-4 mb-4 flex"
11+
class="problem-button mt-4 mb-4"
1212
:class="sendMessage && type !== 'log' ? 'cursor' : 'disabled'"
1313
>
14-
<AppIcon iconName="app-edit" class="mr-8" style="margin-top: 2px"></AppIcon>
15-
{{ item.content }}
14+
<el-space :size="8" alignment="flex-start">
15+
<AppIcon iconName="app-edit" class="color-primary" style="margin-top: 3px;"></AppIcon>
16+
{{ item.content }}
17+
</el-space>
1618
</div>
1719
<HtmlRander v-else-if="item.type === 'html_rander'" :source="item.content"></HtmlRander>
1820
<EchartsRander
@@ -251,8 +253,9 @@ const split_form_rander_ = (source: string, type: string) => {
251253
}
252254
}
253255
254-
:deep(.el-icon) {
255-
color: var(--el-color-primary);
256-
}
256+
// :deep(.el-icon) {
257+
// color: var(--el-color-primary);
258+
// margin-top: 3px;
259+
// }
257260
}
258261
</style>

ui/src/components/pdf-export/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
v-model="dialogVisible"
44
:title="$t('chat.preview')"
55
style="overflow: auto"
6-
width="80%"
6+
width="60%"
77
:before-close="close"
88
destroy-on-close
9+
align-center
910
>
1011
<div
1112
v-loading="loading"
12-
style="height: calc(70vh - 150px); overflow-y: auto; display: flex; justify-content: center"
13+
style="max-height: calc(100vh - 200px); overflow-y: auto; display: flex; justify-content: center"
1314
>
1415
<div ref="cloneContainerRef" style="width: 100%"></div>
1516
<div ref="svgContainerRef"></div>

ui/src/layout/layout-header/avatar/APIKeyDialog.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,12 @@ function settingApiKey(row: any) {
105105
106106
function deleteApiKey(row: any) {
107107
MsgConfirm(
108-
// @ts-ignore
109108
`${t('views.applicationOverview.appInfo.APIKeyDialog.msgConfirm1')}: ${row.secret_key}?`,
110109
t(t('views.applicationOverview.appInfo.APIKeyDialog.msgConfirm2')),
111110
{
112111
confirmButtonText: t('common.confirm'),
113112
cancelButtonText: t('common.cancel'),
114-
confirmButtonClass: 'color-danger',
113+
confirmButtonClass: 'danger',
115114
},
116115
)
117116
.then(() => {
@@ -128,8 +127,8 @@ function changeState(bool: boolean, row: any) {
128127
is_active: bool,
129128
}
130129
const str = bool
131-
? t('views.applicationOverview.appInfo.APIKeyDialog.enabledSuccess')
132-
: t('views.applicationOverview.appInfo.APIKeyDialog.disabledSuccess')
130+
? t('common.enabled')
131+
: t('common.disabled')
133132
systemKeyApi.putAPIKey(row.id, obj, loading).then((res) => {
134133
MsgSuccess(str)
135134
getApiKeyList()

ui/src/layout/layout-header/avatar/index.vue

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
<el-dropdown trigger="click" type="primary">
33
<div class="flex-center cursor">
44
<el-avatar :size="30">
5-
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
5+
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
66
</el-avatar>
77
<span class="ml-8 color-text-primary">{{ user.userInfo?.username }}</span>
88
<el-icon class="el-icon--right">
9-
<CaretBottom />
9+
<CaretBottom/>
1010
</el-icon>
1111
</div>
1212

@@ -15,7 +15,7 @@
1515
<div class="userInfo flex align-center">
1616
<div class="mr-12 flex align-center">
1717
<el-avatar :size="30">
18-
<img src="@/assets/user-icon.svg" style="width: 54%" alt="" />
18+
<img src="@/assets/user-icon.svg" style="width: 54%" alt=""/>
1919
</el-avatar>
2020
</div>
2121
<div style="width: 90%">
@@ -102,7 +102,7 @@
102102
<div class="flex-between w-full" style="line-height: 22px; padding: 12px 11px">
103103
<span> {{ $t('layout.language') }}</span>
104104
<el-icon>
105-
<ArrowRight />
105+
<ArrowRight/>
106106
</el-icon>
107107
</div>
108108

@@ -116,14 +116,14 @@
116116
class="flex-between"
117117
>
118118
<span :class="lang.value === user.userInfo?.language ? 'primary' : ''">{{
119-
lang.label
120-
}}</span>
119+
lang.label
120+
}}</span>
121121

122122
<el-icon
123123
:class="lang.value === user.userInfo?.language ? 'primary' : ''"
124124
v-if="lang.value === user.userInfo?.language"
125125
>
126-
<Check />
126+
<Check/>
127127
</el-icon>
128128
</el-dropdown-item>
129129
</el-dropdown-menu>
@@ -143,26 +143,26 @@
143143
</el-dropdown-menu>
144144
</template>
145145
</el-dropdown>
146-
<APIKeyDialog :user-id="user.userInfo?.id" ref="APIKeyDialogRef" />
146+
<APIKeyDialog :user-id="user.userInfo?.id" ref="APIKeyDialogRef"/>
147147
<ResetPassword ref="resetPasswordRef"></ResetPassword>
148148
<AboutDialog ref="AboutDialogRef"></AboutDialog>
149149

150150
<!-- <UserPwdDialog ref="UserPwdDialogRef" /> -->
151151
</template>
152152
<script setup lang="ts">
153-
import { ref, onMounted } from 'vue'
153+
import {ref, onMounted} from 'vue'
154154
import useStore from '@/stores'
155-
import { useRouter } from 'vue-router'
155+
import {useRouter} from 'vue-router'
156156
import ResetPassword from './ResetPassword.vue'
157157
import AboutDialog from './AboutDialog.vue'
158158
// import UserPwdDialog from '@/views/user-manage/component/UserPwdDialog.vue'
159159
import APIKeyDialog from './APIKeyDialog.vue'
160-
import { ComplexPermission } from '@/utils/permission/type'
161-
import { langList } from '@/locales/index'
162-
import { hasPermission } from '@/utils/permission'
163-
import { PermissionConst, RoleConst, EditionConst } from '@/utils/permission/data'
160+
import {ComplexPermission} from '@/utils/permission/type'
161+
import {langList} from '@/locales/index'
162+
import {hasPermission} from '@/utils/permission'
163+
import {PermissionConst, RoleConst, EditionConst} from '@/utils/permission/data'
164164
165-
const { user, login } = useStore()
165+
const {user, login} = useStore()
166166
const router = useRouter()
167167
168168
const AboutDialogRef = ref()
@@ -188,13 +188,13 @@ const openResetPassword = () => {
188188
189189
const logout = () => {
190190
login.logout().then(() => {
191-
router.push({ name: 'login' })
191+
router.push({name: 'login'})
192192
})
193193
}
194194
195195
onMounted(() => {
196196
if (user.userInfo?.is_edit_password) {
197-
// UserPwdDialogRef.value.open(user.userInfo)
197+
resetPasswordRef.value?.open()
198198
}
199199
})
200200
</script>

ui/src/locales/lang/en-US/ai-chat.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ export default {
1313
exportImg: 'Exporting images',
1414
preview: 'Preview',
1515
chatId: 'Chat ID',
16+
chatUserId: 'Chat User ID',
17+
chatUserType: 'Chat User Type',
1618
userInput: 'User Input',
1719
quote: 'Quote',
1820
download: 'Click to Download',
@@ -77,6 +79,7 @@ export default {
7779
otherMessage: 'Please understand the file content',
7880
errorMessage: 'Upload Failed',
7981
fileMessage: 'Please process the file content',
82+
fileRepeat: 'File already exists',
8083
},
8184
executionDetails: {
8285
title: 'Execution Details',
@@ -96,6 +99,7 @@ export default {
9699
paragraph: 'Segment',
97100
noSubmit: 'No submission from user',
98101
errMessage: 'Error Log',
102+
knowedMessage: 'Known Information',
99103
},
100104
KnowledgeSource: {
101105
title: 'Knowledge Source',
@@ -109,11 +113,6 @@ export default {
109113
question: 'User Question',
110114
optimizationQuestion: 'Optimized Question',
111115
questionPadded: 'Padded Question',
112-
system: 'Role Setting',
113-
historyRecord: 'History Record',
114-
currentChat: 'Current Chat',
115-
AiResponse: 'AiResponse',
116-
knowedMessage: 'Knowed Information',
117116
},
118117
editTitle: 'Edit Title',
119118
}

ui/src/locales/lang/en-US/views/404.ts

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

ui/src/locales/lang/en-US/views/application-overview.ts

Lines changed: 27 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ export default {
2424
msgConfirm1: 'Are you sure you want to delete the API Key',
2525
msgConfirm2:
2626
'This action is irreversible. Once deleted, the API Key cannot be recovered. Do you still want to proceed?',
27-
enabledSuccess: 'Enabled',
28-
disabledSuccess: 'Disabled',
2927
},
3028
EmbedDialog: {
3129
fullscreenModeTitle: 'Fullscreen Mode',
@@ -34,8 +32,6 @@ export default {
3432
mobileModeTitle: 'Mobile Mode',
3533
},
3634
LimitDialog: {
37-
dialogTitle: 'Access Restrictions',
38-
showSourceLabel: 'Show Knowledge Source',
3935
clientQueryLimitLabel: 'Query Limit per Client',
4036
authentication: 'Authentication',
4137
authenticationValue: 'Password Access',
@@ -52,36 +48,34 @@ export default {
5248
crossDomainPlaceholder:
5349
'Enter allowed cross-domain addresses. If enabled but left blank, no restrictions will apply.\nEnter one per line, e.g.:\nhttp://127.0.0.1:5678\nhttps://dataease.io',
5450
},
55-
SettingDisplayDialog: {
56-
dialogTitle: 'Display Settings',
57-
languageLabel: 'Language',
58-
showSourceLabel: 'Show Knowledge Source',
59-
showExecutionDetail: 'Show Execution Details',
60-
restoreDefault: 'Restore Default',
61-
customThemeColor: 'Custom Theme Color',
62-
headerTitleFontColor: 'Header Title Font Color',
63-
default: 'Default',
64-
askUserAvatar: 'User Avatar (Asking)',
65-
replace: 'Replace',
66-
imageMessage:
67-
'Recommended size: 32×32 pixels. Supports JPG, PNG, and GIF formats. Max size: 10 MB',
68-
AIAvatar: 'AI Avatar',
69-
floatIcon: 'Floating Icon',
70-
iconDefaultPosition: 'Default Icon Position',
71-
iconPosition: {
72-
left: 'Left',
73-
right: 'Right',
74-
bottom: 'Bottom',
75-
top: 'Top',
76-
},
77-
draggablePosition: 'Draggable Position',
78-
showHistory: 'Show Chat History',
79-
displayGuide: 'Show Guide Image (Floating Mode)',
80-
disclaimer: 'Disclaimer',
81-
disclaimerValue: 'This content is AI-generated and for reference only.',
82-
chatBackground: 'Chat Background',
83-
chatBackgroundMessage: 'Supported formats: JPG, PNG, GIF. Max size: 10MB.',
51+
},
52+
SettingDisplayDialog: {
53+
showSourceLabel: 'Show Knowledge Source',
54+
showExecutionDetail: 'Show Execution Details',
55+
restoreDefault: 'Restore Default',
56+
customThemeColor: 'Custom Theme Color',
57+
headerTitleFontColor: 'Header Title Font Color',
58+
default: 'Default',
59+
askUserAvatar: 'User Avatar (Asking)',
60+
replace: 'Replace',
61+
imageMessage:
62+
'Recommended size: 32×32 pixels. Supports JPG, PNG, and GIF formats. Max size: 10 MB',
63+
AIAvatar: 'AI Avatar',
64+
floatIcon: 'Floating Icon',
65+
iconDefaultPosition: 'Default Icon Position',
66+
iconPosition: {
67+
left: 'Left',
68+
right: 'Right',
69+
bottom: 'Bottom',
70+
top: 'Top',
8471
},
72+
draggablePosition: 'Draggable Position',
73+
showHistory: 'Show Chat History',
74+
displayGuide: 'Show Guide Image (Floating Mode)',
75+
disclaimer: 'Disclaimer',
76+
disclaimerValue: 'This content is AI-generated and for reference only.',
77+
chatBackground: 'Chat Background',
78+
chatBackgroundMessage: 'Supported formats: JPG, PNG, GIF. Max size: 10MB.',
8579
},
8680
monitor: {
8781
monitoringStatistics: 'Monitoring Statistics',

0 commit comments

Comments
 (0)