Merge remote-tracking branch 'origin/main'

This commit is contained in:
wangjiahao
2025-07-24 21:27:17 +08:00
15 changed files with 118 additions and 61 deletions
+2 -1
View File
@@ -75,7 +75,7 @@ const logout = () => {
<template #reference>
<button class="person" :class="collapse && 'collapse'">
<img class="default-avatar" :src="Default_avatar" width="32px" height="32px" />
<span v-if="!collapse" class="name">{{ name }}</span>
<span v-if="!collapse" class="name ellipsis" :title="name">{{ name }}</span>
</button></template
>
<div class="popover">
@@ -184,6 +184,7 @@ const logout = () => {
font-size: 14px;
line-height: 22px;
margin-left: 8px;
max-width: 85px;
}
&::after {
+1 -1
View File
@@ -70,11 +70,11 @@ defineExpose({
<div class="params-form">
<el-form
ref="pwdRef"
@submit.prevent
:rules="rules"
label-position="top"
:model="pwdForm"
style="width: 100%"
@submit.prevent
>
<el-form-item prop="pwd" :label="t('user.upgrade_pwd.old_pwd')">
<el-input
+4 -2
View File
@@ -115,7 +115,9 @@
"today": "Today",
"week": "This Week",
"earlier": "Earlier",
"no_time": "No Time"
"no_time": "No Time",
"rename_conversation_title": "Rename conversation title",
"conversation_title": "Conversation title"
},
"ds": {
"title": "Data Source",
@@ -503,4 +505,4 @@
"back_community": "Restore to Community Edition",
"confirm_tips": "Are you sure to restore to Community Edition?"
}
}
}
+4 -2
View File
@@ -118,7 +118,9 @@
"today": "今天",
"week": "7天内",
"earlier": "更早以前",
"no_time": "没有时间"
"no_time": "没有时间",
"rename_conversation_title": "重命名对话标题",
"conversation_title": "对话标题"
},
"ds": {
"title": "数据源",
@@ -515,4 +517,4 @@
"back_community": "还原至社区版",
"confirm_tips": "确定还原至社区版?"
}
}
}
+89 -34
View File
@@ -4,7 +4,7 @@ import icon_expand_down_filled from '@/assets/embedded/icon_expand-down_filled.s
import rename from '@/assets/svg/icon_rename_outlined.svg'
import delIcon from '@/assets/svg/icon_delete.svg'
import { type Chat, chatApi } from '@/api/chat.ts'
import { computed, ref } from 'vue'
import { computed, reactive, ref } from 'vue'
import dayjs from 'dayjs'
import { getDate } from '@/utils/utils.ts'
import { groupBy } from 'lodash-es'
@@ -107,39 +107,9 @@ function handleCommand(command: string | number | object, chat: Chat) {
if (chat && chat.id !== undefined) {
switch (command) {
case 'rename':
ElMessageBox.prompt('Please enter new brief', 'Rename', {
confirmButtonText: 'OK',
cancelButtonText: 'Cancel',
customStyle: { 'padding-left': 'unset', padding: 'var(--ed-messagebox-padding-primary)' },
inputValue: chat.brief,
inputValidator: (value: string) => {
if (!value) return false
if (value.trim().length == 0) return false
return true
},
}).then(({ value }) => {
_loading.value = true
chatApi
.renameChat(chat.id, value)
.then((res) => {
ElMessage({
type: 'success',
message: 'Successfully renamed chat',
})
emits('chatRenamed', { id: chat.id, brief: res })
})
.catch((err) => {
ElMessage({
type: 'error',
message: err.message,
})
console.error(err)
})
.finally(() => {
_loading.value = false
})
})
password.id = chat.id
password.name = chat.brief as string
dialogVisiblePassword.value = true
break
case 'delete':
ElMessageBox.confirm('This action will permanently delete the chat. Continue?', 'Warning', {
@@ -173,6 +143,56 @@ function handleCommand(command: string | number | object, chat: Chat) {
}
}
}
const passwordRef = ref()
const dialogVisiblePassword = ref(false)
const password = reactive({
name: '',
id: 0,
})
const passwordRules = {
name: [
{
required: true,
message: t('datasource.please_enter') + t('common.empty') + t('qa.conversation_title'),
trigger: 'blur',
},
],
}
const handleClosePassword = () => {
passwordRef.value.clearValidate()
dialogVisiblePassword.value = false
password.id = 0
password.name = ''
}
const handleConfirmPassword = () => {
passwordRef.value.validate((res: any) => {
if (res) {
chatApi
.renameChat(password.id, password.name)
.then((res) => {
ElMessage({
type: 'success',
message: t('common.save_success'),
})
emits('chatRenamed', { id: password.id, brief: res })
handleClosePassword()
})
.catch((err) => {
ElMessage({
type: 'error',
message: err.message,
})
console.error(err)
})
.finally(() => {
_loading.value = false
})
}
})
}
</script>
<template>
@@ -222,6 +242,41 @@ function handleCommand(command: string | number | object, chat: Chat) {
</div>
</div>
</el-scrollbar>
<el-dialog
v-model="dialogVisiblePassword"
:title="$t('qa.rename_conversation_title')"
width="420"
:before-close="handleClosePassword"
>
<el-form
ref="passwordRef"
:model="password"
label-width="180px"
label-position="top"
:rules="passwordRules"
class="form-content_error"
@submit.prevent
>
<el-form-item prop="name" :label="t('qa.conversation_title')">
<el-input
v-model="password.name"
maxlength="20"
:placeholder="
$t('datasource.please_enter') + $t('common.empty') + $t('qa.conversation_title')
"
autocomplete="off"
/>
</el-form-item>
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button secondary @click="handleClosePassword">{{ $t('common.cancel') }}</el-button>
<el-button type="primary" @click="handleConfirmPassword">
{{ $t('common.save') }}
</el-button>
</div>
</template>
</el-dialog>
</template>
<style scoped lang="less">
@@ -156,6 +156,10 @@ const sendMessage = async () => {
}
switch (data.type) {
case 'id':
currentRecord.id = data.id
_currentChat.value.records[index.value].id = data.id
break
case 'info':
console.log(data.msg)
break
@@ -155,6 +155,10 @@ const sendMessage = async () => {
}
switch (data.type) {
case 'id':
currentRecord.id = data.id
_currentChat.value.records[index.value].id = data.id
break
case 'info':
console.log(data.msg)
break
+1 -1
View File
@@ -569,7 +569,7 @@ function getChatPredictData(recordId?: number) {
chatApi.get_chart_predict_data(recordId).then((response) => {
currentChat.value.records.forEach((record) => {
if (record.id === recordId) {
record.predict_data = response
record.predict_data = response.data ?? []
}
})
})
-2
View File
@@ -17,8 +17,6 @@ defineProps({
default: () => {},
},
})
const emits = defineEmits(['panelClick', 'smartClick'])
</script>
<template>
+1 -1
View File
@@ -26,12 +26,12 @@
<div v-show="active === 0" class="container">
<el-form
@submit.prevent
ref="dsFormRef"
:model="form"
label-position="top"
label-width="auto"
:rules="rules"
@submit.prevent
>
<el-form-item :label="t('ds.form.name')" prop="name">
<el-input v-model="form.name" />
+1 -1
View File
@@ -64,8 +64,8 @@
label-width="180px"
label-position="top"
class="sqlbot-form"
@submit.prevent
size="large"
@submit.prevent
>
<el-form-item label="Term name">
<el-input v-model="state.form.term" autocomplete="off" />
@@ -46,7 +46,7 @@ const handlePublic = () => {
<div class="name-icon">
<img :src="icon" width="32px" height="32px" />
<div class="info">
<div class="name">{{ name }}</div>
<div class="name ellipsis" :title="name">{{ name }}</div>
<div class="type">{{ typeName }}</div>
</div>
<span class="default" :class="isPrivate && 'is-private'">{{
@@ -106,6 +106,7 @@ const handlePublic = () => {
font-weight: 500;
font-size: 16px;
line-height: 24px;
max-width: 250px;
}
.type {
font-weight: 400;
+1 -12
View File
@@ -253,13 +253,6 @@ const dsRules = {
trigger: 'change',
},
],
private_list: [
{
required: true,
message: t('datasource.please_enter') + t('common.empty') + t('user.workspace'),
trigger: 'change',
},
],
}
const urlRules = {
@@ -934,11 +927,7 @@ const saveHandler = () => {
align-items: center;
.open-the_query {
color: #ff8800;
&::before {
color: var(--ed-color-danger);
content: '*';
margin-left: 2px;
}
margin-left: 4px;
}
}
@@ -498,7 +498,7 @@ const columnRules = {
table_id: [
{
required: true,
message: t('datasource.Please_select') + t('common.empty') + t('permission.set_rule'),
message: t('datasource.Please_select') + t('common.empty') + t('permission.data_table'),
trigger: 'change',
},
],
@@ -609,9 +609,9 @@ const columnRules = {
>
<el-form-item prop="name" :label="t('permission.rule_group_name')">
<el-input
v-model="currentPermission.name"
maxlength="50"
clearable
v-model="currentPermission.name"
:placeholder="
$t('datasource.please_enter') +
$t('common.empty') +
@@ -850,6 +850,7 @@ const columnRules = {
.ed-empty_200 {
padding-top: 200px;
padding-bottom: 0;
height: auto;
}
.tool-left {
display: flex;
+1 -1
View File
@@ -279,7 +279,7 @@
</el-form>
<template #footer>
<div class="dialog-footer">
<el-button @click="handleClosePassword">{{ $t('common.cancel') }}</el-button>
<el-button secondary @click="handleClosePassword">{{ $t('common.cancel') }}</el-button>
<el-button type="primary" @click="handleConfirmPassword">
{{ $t('common.save') }}
</el-button>