Skip to content

Commit 4c2115e

Browse files
Merge branch 'main' into pr@main@fix_embedded_security_vulnerabilities
2 parents 0633d55 + a70eb1b commit 4c2115e

6 files changed

Lines changed: 45 additions & 21 deletions

File tree

backend/apps/db/db.py

Lines changed: 29 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -640,6 +640,20 @@ def is_numeric_type_code(type_code, dialect_name: str) -> bool:
640640
type_str = str(type_code).upper()
641641
return any(kw in type_str for kw in ['NUMBER', 'FLOAT', 'INTEGER', 'BINARY_FLOAT', 'BINARY_DOUBLE'])
642642

643+
if dialect_name == 'clickhouse':
644+
if isinstance(type_code, str):
645+
upper_type = type_code.upper()
646+
# 数值类型关键字
647+
numeric_prefixes = (
648+
'INT', # Int8/16/32/64
649+
'UINT', # UInt8/16/32/64 ✅ 加上 UINT
650+
'FLOAT', # Float32, Float64
651+
'DECIMAL', # Decimal, Decimal32/64/128
652+
'BOOL', # Bool
653+
'BIT', # 极少数场景
654+
)
655+
return any(upper_type.startswith(p) for p in numeric_prefixes)
656+
643657
# ---------- SQL Server (pyodbc / pymssql) ----------
644658
if dialect_name == 'mssql':
645659
if isinstance(type_code, int):
@@ -841,7 +855,7 @@ def build_fields_info_from_cursor(cursor, origin_column, db_type='postgresql'):
841855
for col_info in cursor.description:
842856
col_name = col_info[0]
843857

844-
if db_type == 'mysql':
858+
if db_type in ('mysql', 'mariadb', 'doris', 'starrocks'):
845859
# MySQL/pymysql 类型码
846860
is_numeric = col_info[1] in (
847861
1, # TINYINT
@@ -852,34 +866,32 @@ def build_fields_info_from_cursor(cursor, origin_column, db_type='postgresql'):
852866
8, # BIGINT
853867
9, # MEDIUMINT
854868
16, # BIT
855-
246, # DECIMAL
869+
246, # DECIMAL/NEWDECIMAL
856870
)
857871
elif db_type in ('postgresql', 'redshift', 'kingbase'):
858872
# PostgreSQL/psycopg2 类型 OID
859873
is_numeric = col_info[1] in (
874+
16, # bool
860875
20, # int8
861876
21, # int2
862877
23, # int4
863878
700, # float4
864879
701, # float8
880+
790, # money
865881
1700, # numeric
866-
16, # boolean
867882
)
868883
elif db_type == 'dm':
869-
# 达梦数据库类型码
870-
is_numeric = col_info[1] in (
871-
3, # DECIMAL/NUMERIC
872-
2, # NUMBER
873-
4, # INTEGER
874-
5, # INT
875-
6, # BIGINT
876-
7, # TINYINT
877-
8, # BYTE
878-
9, # FLOAT
879-
10, # DOUBLE
880-
11, # REAL
881-
12, # BOOLEAN
882-
)
884+
# 达梦数据库类型码 <class 'dmPython.DECIMAL'>
885+
# 获取类型类名
886+
type_name = col_info[1].__name__.upper() if hasattr(col_info[1], '__name__') else str(col_info[1]).upper()
887+
888+
is_numeric = type_name in {
889+
'INT', 'INTEGER',
890+
'BIGINT', 'SMALLINT', 'TINYINT',
891+
'NUMBER', 'NUMERIC', 'DECIMAL',
892+
'FLOAT', 'DOUBLE', 'REAL',
893+
'BIT', 'BOOLEAN',
894+
}
883895
elif db_type == 'hive':
884896
# Hive 类型对象转字符串判断
885897
type_str = str(col_info[1]).lower()

frontend/src/views/chat/chat-block/ChartBlock.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ function addToDashboard() {
264264
}
265265
266266
recordeInfo['chart'] = {
267-
type: chartBaseInfo?.type,
267+
type: currentChartType.value ?? chartBaseInfo?.type,
268268
title: chartBaseInfo?.title,
269269
columns: chartBaseInfo?.columns,
270270
xAxis: axis?.x ? [axis?.x] : [],

frontend/src/views/dashboard/canvas/CanvasCore.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,11 @@ function startResize(e: MouseEvent, point: string, item: CanvasItem, index: numb
727727
infoBox.value.point = point
728728
}
729729
730-
function containerClick() {
730+
function containerClick(e?: MouseEvent) {
731+
// Ignore clicks that originate inside a component so interacting with component
732+
// content (e.g. selecting/copying cells in an S2 table) does not clear the
733+
// current selection. Only blank-canvas clicks deselect.
734+
if ((e?.target as HTMLElement)?.closest?.('.item')) return
731735
// remove current component info
732736
dashboardStore.setCurComponent(null)
733737
}

frontend/src/views/dashboard/canvas/CanvasShape.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@ const props = defineProps({
5252
5353
const { draggable } = toRefs(props)
5454
const shapeClick = (e: MouseEvent) => {
55-
e.stopPropagation()
55+
// Do not stopPropagation here: the click must reach window so components that
56+
// rely on a window-level click listener (e.g. the S2 table copy interaction,
57+
// which only enables Cmd/Ctrl+C when the last click landed on its canvas) work
58+
// inside the editor. Deselection is handled by containerClick ignoring clicks
59+
// that originate inside a component.
5660
e.preventDefault()
5761
}
5862

frontend/src/views/ds/RecommendedProblemConfigDialog.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ defineExpose({
164164
</template>
165165

166166
<style scoped lang="less">
167+
:deep(.ed-radio__label) {
168+
font-weight: 400;
169+
}
167170
.btn {
168171
margin-left: auto;
169172
height: 26px;

frontend/src/views/embedded/index.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
</div>
2121
<div class="sqlbot-chat-container">
2222
<chat-component
23-
v-if="!loading"
23+
v-if="!loading && tokenReady"
2424
ref="chatRef"
2525
:welcome="customSet.welcome"
2626
:welcome-desc="customSet.welcome_desc"
@@ -79,6 +79,7 @@ const openHistory = () => {
7979
}) */
8080
const appName = ref('')
8181
const loading = ref(true)
82+
const tokenReady = ref(false)
8283
const eventName = 'sqlbot_assistant_event'
8384
8485
let resolveTokenReady: ((data: any) => any) | null = null

0 commit comments

Comments
 (0)