Skip to content

Commit 13d4778

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 53af5ad + edaeac0 commit 13d4778

File tree

15 files changed

+118
-61
lines changed

15 files changed

+118
-61
lines changed

frontend/src/components/layout/Person.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ const logout = () => {
7575
<template #reference>
7676
<button class="person" :class="collapse && 'collapse'">
7777
<img class="default-avatar" :src="Default_avatar" width="32px" height="32px" />
78-
<span v-if="!collapse" class="name">{{ name }}</span>
78+
<span v-if="!collapse" class="name ellipsis" :title="name">{{ name }}</span>
7979
</button></template
8080
>
8181
<div class="popover">
@@ -184,6 +184,7 @@ const logout = () => {
184184
font-size: 14px;
185185
line-height: 22px;
186186
margin-left: 8px;
187+
max-width: 85px;
187188
}
188189
189190
&::after {

frontend/src/components/layout/PwdForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,11 @@ defineExpose({
7070
<div class="params-form">
7171
<el-form
7272
ref="pwdRef"
73-
@submit.prevent
7473
:rules="rules"
7574
label-position="top"
7675
:model="pwdForm"
7776
style="width: 100%"
77+
@submit.prevent
7878
>
7979
<el-form-item prop="pwd" :label="t('user.upgrade_pwd.old_pwd')">
8080
<el-input

frontend/src/i18n/en.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,9 @@
115115
"today": "Today",
116116
"week": "This Week",
117117
"earlier": "Earlier",
118-
"no_time": "No Time"
118+
"no_time": "No Time",
119+
"rename_conversation_title": "Rename conversation title",
120+
"conversation_title": "Conversation title"
119121
},
120122
"ds": {
121123
"title": "Data Source",
@@ -503,4 +505,4 @@
503505
"back_community": "Restore to Community Edition",
504506
"confirm_tips": "Are you sure to restore to Community Edition?"
505507
}
506-
}
508+
}

frontend/src/i18n/zh-CN.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@
118118
"today": "今天",
119119
"week": "7天内",
120120
"earlier": "更早以前",
121-
"no_time": "没有时间"
121+
"no_time": "没有时间",
122+
"rename_conversation_title": "重命名对话标题",
123+
"conversation_title": "对话标题"
122124
},
123125
"ds": {
124126
"title": "数据源",
@@ -515,4 +517,4 @@
515517
"back_community": "还原至社区版",
516518
"confirm_tips": "确定还原至社区版?"
517519
}
518-
}
520+
}

frontend/src/views/chat/ChatList.vue

Lines changed: 89 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import icon_expand_down_filled from '@/assets/embedded/icon_expand-down_filled.s
44
import rename from '@/assets/svg/icon_rename_outlined.svg'
55
import delIcon from '@/assets/svg/icon_delete.svg'
66
import { type Chat, chatApi } from '@/api/chat.ts'
7-
import { computed, ref } from 'vue'
7+
import { computed, reactive, ref } from 'vue'
88
import dayjs from 'dayjs'
99
import { getDate } from '@/utils/utils.ts'
1010
import { groupBy } from 'lodash-es'
@@ -107,39 +107,9 @@ function handleCommand(command: string | number | object, chat: Chat) {
107107
if (chat && chat.id !== undefined) {
108108
switch (command) {
109109
case 'rename':
110-
ElMessageBox.prompt('Please enter new brief', 'Rename', {
111-
confirmButtonText: 'OK',
112-
cancelButtonText: 'Cancel',
113-
customStyle: { 'padding-left': 'unset', padding: 'var(--ed-messagebox-padding-primary)' },
114-
inputValue: chat.brief,
115-
inputValidator: (value: string) => {
116-
if (!value) return false
117-
if (value.trim().length == 0) return false
118-
return true
119-
},
120-
}).then(({ value }) => {
121-
_loading.value = true
122-
chatApi
123-
.renameChat(chat.id, value)
124-
.then((res) => {
125-
ElMessage({
126-
type: 'success',
127-
message: 'Successfully renamed chat',
128-
})
129-
emits('chatRenamed', { id: chat.id, brief: res })
130-
})
131-
.catch((err) => {
132-
ElMessage({
133-
type: 'error',
134-
message: err.message,
135-
})
136-
console.error(err)
137-
})
138-
.finally(() => {
139-
_loading.value = false
140-
})
141-
})
142-
110+
password.id = chat.id
111+
password.name = chat.brief as string
112+
dialogVisiblePassword.value = true
143113
break
144114
case 'delete':
145115
ElMessageBox.confirm('This action will permanently delete the chat. Continue?', 'Warning', {
@@ -173,6 +143,56 @@ function handleCommand(command: string | number | object, chat: Chat) {
173143
}
174144
}
175145
}
146+
147+
const passwordRef = ref()
148+
const dialogVisiblePassword = ref(false)
149+
const password = reactive({
150+
name: '',
151+
id: 0,
152+
})
153+
154+
const passwordRules = {
155+
name: [
156+
{
157+
required: true,
158+
message: t('datasource.please_enter') + t('common.empty') + t('qa.conversation_title'),
159+
trigger: 'blur',
160+
},
161+
],
162+
}
163+
164+
const handleClosePassword = () => {
165+
passwordRef.value.clearValidate()
166+
dialogVisiblePassword.value = false
167+
password.id = 0
168+
password.name = ''
169+
}
170+
const handleConfirmPassword = () => {
171+
passwordRef.value.validate((res: any) => {
172+
if (res) {
173+
chatApi
174+
.renameChat(password.id, password.name)
175+
.then((res) => {
176+
ElMessage({
177+
type: 'success',
178+
message: t('common.save_success'),
179+
})
180+
emits('chatRenamed', { id: password.id, brief: res })
181+
handleClosePassword()
182+
})
183+
.catch((err) => {
184+
ElMessage({
185+
type: 'error',
186+
message: err.message,
187+
})
188+
console.error(err)
189+
})
190+
.finally(() => {
191+
_loading.value = false
192+
})
193+
}
194+
})
195+
}
176196
</script>
177197

178198
<template>
@@ -222,6 +242,41 @@ function handleCommand(command: string | number | object, chat: Chat) {
222242
</div>
223243
</div>
224244
</el-scrollbar>
245+
<el-dialog
246+
v-model="dialogVisiblePassword"
247+
:title="$t('qa.rename_conversation_title')"
248+
width="420"
249+
:before-close="handleClosePassword"
250+
>
251+
<el-form
252+
ref="passwordRef"
253+
:model="password"
254+
label-width="180px"
255+
label-position="top"
256+
:rules="passwordRules"
257+
class="form-content_error"
258+
@submit.prevent
259+
>
260+
<el-form-item prop="name" :label="t('qa.conversation_title')">
261+
<el-input
262+
v-model="password.name"
263+
maxlength="20"
264+
:placeholder="
265+
$t('datasource.please_enter') + $t('common.empty') + $t('qa.conversation_title')
266+
"
267+
autocomplete="off"
268+
/>
269+
</el-form-item>
270+
</el-form>
271+
<template #footer>
272+
<div class="dialog-footer">
273+
<el-button secondary @click="handleClosePassword">{{ $t('common.cancel') }}</el-button>
274+
<el-button type="primary" @click="handleConfirmPassword">
275+
{{ $t('common.save') }}
276+
</el-button>
277+
</div>
278+
</template>
279+
</el-dialog>
225280
</template>
226281

227282
<style scoped lang="less">

frontend/src/views/chat/answer/AnalysisAnswer.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,10 @@ const sendMessage = async () => {
156156
}
157157
158158
switch (data.type) {
159+
case 'id':
160+
currentRecord.id = data.id
161+
_currentChat.value.records[index.value].id = data.id
162+
break
159163
case 'info':
160164
console.log(data.msg)
161165
break

frontend/src/views/chat/answer/PredictAnswer.vue

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ const sendMessage = async () => {
155155
}
156156
157157
switch (data.type) {
158+
case 'id':
159+
currentRecord.id = data.id
160+
_currentChat.value.records[index.value].id = data.id
161+
break
158162
case 'info':
159163
console.log(data.msg)
160164
break

frontend/src/views/chat/index.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ function getChatPredictData(recordId?: number) {
569569
chatApi.get_chart_predict_data(recordId).then((response) => {
570570
currentChat.value.records.forEach((record) => {
571571
if (record.id === recordId) {
572-
record.predict_data = response
572+
record.predict_data = response.data ?? []
573573
}
574574
})
575575
})

frontend/src/views/ds/DelMessageBox.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ defineProps({
1717
default: () => {},
1818
},
1919
})
20-
21-
const emits = defineEmits(['panelClick', 'smartClick'])
2220
</script>
2321

2422
<template>

frontend/src/views/ds/form.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@
2626

2727
<div v-show="active === 0" class="container">
2828
<el-form
29-
@submit.prevent
3029
ref="dsFormRef"
3130
:model="form"
3231
label-position="top"
3332
label-width="auto"
3433
:rules="rules"
34+
@submit.prevent
3535
>
3636
<el-form-item :label="t('ds.form.name')" prop="name">
3737
<el-input v-model="form.name" />

0 commit comments

Comments
 (0)