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] = [] diff --git a/backend/apps/datasource/crud/datasource.py b/backend/apps/datasource/crud/datasource.py index 3d01880e..2e461291 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} @@ -408,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 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/style.less b/frontend/src/style.less index 24daf4d6..4be66b86 100644 --- a/frontend/src/style.less +++ b/frontend/src/style.less @@ -31,6 +31,7 @@ --ed-color-primary-dark-2: #189e7a !important; --ed-color-primary-1a: #1cba901a; --ed-color-primary-light-5: #3ec4a1 !important; + --ed-border-color: #d9dcdf !important; } a { diff --git a/frontend/src/views/chat/ChatListContainer.vue b/frontend/src/views/chat/ChatListContainer.vue index 88fc48f0..3618c47c 100644 --- a/frontend/src/views/chat/ChatListContainer.vue +++ b/frontend/src/views/chat/ChatListContainer.vue @@ -214,7 +214,11 @@ function onChatRenamed(chat: Chat) { /> + 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 @@ + + + + + + diff --git a/frontend/src/views/chat/index.vue b/frontend/src/views/chat/index.vue index 514d4db6..6d4226f9 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; - } - } } } diff --git a/frontend/src/views/system/permission/SelectPermission.vue b/frontend/src/views/system/permission/SelectPermission.vue index d59dcbdf..751cfb51 100644 --- a/frontend/src/views/system/permission/SelectPermission.vue +++ b/frontend/src/views/system/permission/SelectPermission.vue @@ -120,7 +120,7 @@ const open = async (user: any) => { checkAll.value = false isIndeterminate.value = false const systemWorkspaceList = await workspaceUserList({}, 1, 1000) - workspace.value = systemWorkspaceList.items.filter((ele: any) => ele.weight !== 1) as any + workspace.value = systemWorkspaceList.items as any if (user?.length) { checkedWorkspace.value = workspace.value.filter((ele) => user.includes(ele.id)) handleCheckedWorkspaceChange(checkedWorkspace.value) diff --git a/frontend/src/views/system/permission/index.vue b/frontend/src/views/system/permission/index.vue index 29231d7a..5a01c2dd 100644 --- a/frontend/src/views/system/permission/index.vue +++ b/frontend/src/views/system/permission/index.vue @@ -219,6 +219,7 @@ const handleInitDsIdChange = (val: any) => { activeTable.value = null fieldListOptions.value = [] columnForm.permissions = [] + authTreeRef.value.init({}) }) } diff --git a/frontend/src/views/system/user/User.vue b/frontend/src/views/system/user/User.vue index b3afc4f2..089a1caa 100644 --- a/frontend/src/views/system/user/User.vue +++ b/frontend/src/views/system/user/User.vue @@ -758,6 +758,10 @@ onMounted(() => { width: 100%; max-height: calc(100vh - 150px); overflow-y: auto; + + :deep(.ed-popper.is-dark) { + max-width: 400px; + } :deep(.ed-table) { --el-table-header-bg-color: #f5f7fa; --el-table-border-color: #ebeef5;