From 85d814661819d9b2de2a0c53d7fba5e1c3adf019 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Fri, 25 Jul 2025 10:31:26 +0800 Subject: [PATCH 01/11] fix: bug fix --- .../src/views/chat/chat-block/ChartBlock.vue | 27 ++-- .../views/chat/chat-block/ChartPopover.vue | 151 ++++++++++++++++++ 2 files changed, 161 insertions(+), 17 deletions(-) create mode 100644 frontend/src/views/chat/chat-block/ChartPopover.vue diff --git a/frontend/src/views/chat/chat-block/ChartBlock.vue b/frontend/src/views/chat/chat-block/ChartBlock.vue index c8cf7aa6..3e1f03cb 100644 --- a/frontend/src/views/chat/chat-block/ChartBlock.vue +++ b/frontend/src/views/chat/chat-block/ChartBlock.vue @@ -1,6 +1,7 @@ + + + + + + From c3a34dc569ccc89ba1e41831a24af4c3ad13f84f Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 25 Jul 2025 10:33:10 +0800 Subject: [PATCH 02/11] feat: db sql --- backend/apps/datasource/crud/datasource.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/apps/datasource/crud/datasource.py b/backend/apps/datasource/crud/datasource.py index 3d01880e..fe470005 100644 --- a/backend/apps/datasource/crud/datasource.py +++ b/backend/apps/datasource/crud/datasource.py @@ -292,10 +292,9 @@ def preview(session: SessionDep, current_user: CurrentUser, id: int, data: Table {where} LIMIT 100""" elif ds.type == "sqlServer": - sql = f"""SELECT [{"], [".join(fields)}] FROM [{conf.dbSchema}].[{data.table.table_name}] + sql = f"""SELECT TOP 100 [{"], [".join(fields)}] FROM [{conf.dbSchema}].[{data.table.table_name}] {where} - ORDER BY [{fields[0]}] - OFFSET 0 ROWS FETCH NEXT 100 ROWS ONLY""" + """ elif ds.type == "pg" or ds.type == "excel": sql = f"""SELECT "{'", "'.join(fields)}" FROM "{conf.dbSchema}"."{data.table.table_name}" {where} From 14d35c03fecf65af58d13f5714d3e85afa6baeb1 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Fri, 25 Jul 2025 11:04:22 +0800 Subject: [PATCH 03/11] fix: bug fix --- frontend/src/api/chat.ts | 1 + frontend/src/views/chat/index.vue | 128 ++++++++++++++++-------------- 2 files changed, 68 insertions(+), 61 deletions(-) diff --git a/frontend/src/api/chat.ts b/frontend/src/api/chat.ts index 64d9044a..c27e8616 100644 --- a/frontend/src/api/chat.ts +++ b/frontend/src/api/chat.ts @@ -134,6 +134,7 @@ export class Chat { chat_type?: string datasource?: number engine_type?: string + ds_type?: string constructor() constructor( diff --git a/frontend/src/views/chat/index.vue b/frontend/src/views/chat/index.vue index 514d4db6..b7655641 100644 --- a/frontend/src/views/chat/index.vue +++ b/frontend/src/views/chat/index.vue @@ -259,29 +259,35 @@ v-if="computedMessages.length > 0 || (isAssistant && currentChatId)" class="chat-footer" > -
+
-
- -
+ + { + return ( + dsTypeWithImg.find((ele) => currentChat.value.ds_type === ele.type || ele.type === 'excel') || + {} + ).img +}) + function toAssistantHistory(chat: Chat) { currentChat.value = new ChatInfo(chat) if (chat !== undefined && chat.id !== undefined && !loading.value) { @@ -852,21 +866,46 @@ onMounted(() => { flex-direction: column; align-items: center; - .input-container { - flex: 1; - display: flex; - flex-direction: column; - align-items: center; + .input-wrapper { width: 100%; - max-width: 800px; - border-radius: 16px; - border: 1px solid rgba(217, 220, 223, 1); - background: rgba(248, 249, 250, 1); - padding: 12px; - gap: 8px; - position: relative; + .datasource { + width: calc(100% - 2px); + position: absolute; + margin-left: 1px; + margin-top: 1px; + left: 0; + top: 0; + padding-top: 12px; + padding-left: 12px; + z-index: 10; + background: #f8f9fa; + line-height: 22px; + font-size: 14px; + font-weight: 400; + border-top-right-radius: 16px; + border-top-left-radius: 16px; + color: rgba(100, 106, 115, 1); + display: flex; + align-items: center; + + .name { + color: rgba(31, 35, 41, 1); + } + } + + .input-area { + border-color: #d9dcdf; + + :deep(.ed-textarea__inner) { + padding: 42px 12px 52px 12px; + background: #f8f9fa; + border-radius: 16px; + line-height: 24px; + } + } + .input-icon { min-width: unset; position: absolute; @@ -880,39 +919,6 @@ onMounted(() => { border-color: unset; } } - - &:hover { - border-color: rgba(28, 186, 144, 1); - } - } - - .datasource { - width: 100%; - - line-height: 22px; - font-size: 14px; - font-weight: 400; - color: rgba(100, 106, 115, 1); - - .name { - color: rgba(31, 35, 41, 1); - } - } - - .input-wrapper { - width: 100%; - flex: 1; - - .input-area { - height: 100%; - - :deep(.ed-textarea__inner) { - height: 100% !important; - background: transparent; - box-shadow: unset; - padding: unset; - } - } } } From ed8db00ce22a0efc736291d50c293c5c816bc2bf Mon Sep 17 00:00:00 2001 From: ulleo Date: Fri, 25 Jul 2025 11:12:43 +0800 Subject: [PATCH 04/11] feat: chat add ds_type --- backend/apps/chat/curd/chat.py | 1 + backend/apps/chat/models/chat_model.py | 1 + 2 files changed, 2 insertions(+) diff --git a/backend/apps/chat/curd/chat.py b/backend/apps/chat/curd/chat.py index dd22de57..8338cf2b 100644 --- a/backend/apps/chat/curd/chat.py +++ b/backend/apps/chat/curd/chat.py @@ -85,6 +85,7 @@ def get_chat_with_records(session: SessionDep, chart_id: int, current_user: Curr else: chat_info.datasource_exists = True chat_info.datasource_name = ds.name + chat_info.ds_type = ds.type record_list = session.query(ChatRecord).options( load_only(ChatRecord.id, ChatRecord.chat_id, ChatRecord.create_time, ChatRecord.finish_time, diff --git a/backend/apps/chat/models/chat_model.py b/backend/apps/chat/models/chat_model.py index 60fb777d..f095a65d 100644 --- a/backend/apps/chat/models/chat_model.py +++ b/backend/apps/chat/models/chat_model.py @@ -89,6 +89,7 @@ class ChatInfo(BaseModel): chat_type: str = "chat" datasource: Optional[int] = None engine_type: str = '' + ds_type: str = '' datasource_name: str = '' datasource_exists: bool = True records: List[ChatRecord | dict] = [] From 748a4189b3ada5488038c7946fc3a14d87f83b28 Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 25 Jul 2025 11:16:49 +0800 Subject: [PATCH 05/11] feat: permission normal user --- backend/apps/datasource/crud/datasource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/apps/datasource/crud/datasource.py b/backend/apps/datasource/crud/datasource.py index fe470005..2e461291 100644 --- a/backend/apps/datasource/crud/datasource.py +++ b/backend/apps/datasource/crud/datasource.py @@ -407,4 +407,4 @@ def filter_list(list_a, list_b): def is_normal_user(current_user: CurrentUser): - return current_user.id != 1 and (current_user.weight is not None and current_user.weight != 1) + return current_user.id != 1 From add7e33bc6991500320d89daddc9499718341825 Mon Sep 17 00:00:00 2001 From: dataeaseShu Date: Fri, 25 Jul 2025 11:19:18 +0800 Subject: [PATCH 06/11] fix: bug fix --- frontend/src/views/chat/index.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/chat/index.vue b/frontend/src/views/chat/index.vue index b7655641..6d4226f9 100644 --- a/frontend/src/views/chat/index.vue +++ b/frontend/src/views/chat/index.vue @@ -259,7 +259,7 @@ v-if="computedMessages.length > 0 || (isAssistant && currentChatId)" class="chat-footer" > -
+