Skip to content

Commit 768fd26

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 360e7dc + 26106cd commit 768fd26

7 files changed

Lines changed: 31 additions & 14 deletions

File tree

backend/apps/chat/models/chat_model.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@ class Chat(SQLModel, table=True):
2424
chat_type: str = Field(max_length=20, default="chat") # chat, datasource
2525
datasource: int = Field(sa_column=Column(BigInteger, nullable=True))
2626
engine_type: str = Field(max_length=64)
27-
origin: Optional[int] = Field(sa_column=Column(Integer, nullable=False, default=0)) # 0: default, 1: mcp, 2: assistant
27+
origin: Optional[int] = Field(
28+
sa_column=Column(Integer, nullable=False, default=0)) # 0: default, 1: mcp, 2: assistant
2829

2930

3031
class ChatRecord(SQLModel, table=True):
@@ -152,11 +153,12 @@ def filter_user_question(self):
152153

153154

154155
class ChatQuestion(AiModelQuestion):
155-
question: str = ''
156-
chat_id: int = 0
156+
question: str
157+
chat_id: int
158+
157159

158160
class ChatMcp(ChatQuestion):
159-
token: str = ''
161+
token: str
160162

161163

162164
class ChatStart(BaseModel):

backend/apps/system/crud/assistant.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,14 +132,24 @@ def get_simple_ds_list(self):
132132
def get_db_schema(self, ds_id: int) -> str:
133133
ds = self.get_ds(ds_id)
134134
schema_str = ""
135-
db_name = ds.db_schema
135+
#db_name = ds.db_schema
136+
db_name = ds.db_schema if ds.db_schema is not None and ds.db_schema != "" else ds.dataBase
136137
schema_str += f"【DB_ID】 {db_name}\n【Schema】\n"
137138
for table in ds.tables:
138-
schema_str += f"# Table: {db_name}.{table.name}"
139-
schema_str += f", {table.comment}\n[\n"
139+
schema_str += f"# Table: {db_name}.{table.name}" if ds.type != "mysql" else f"# Table: {table.name}"
140+
table_comment = table.comment
141+
if table_comment == '':
142+
schema_str += '\n[\n'
143+
else:
144+
schema_str += f", {table_comment}\n[\n"
145+
140146
field_list = []
141147
for field in table.fields:
142-
field_list.append(f"({field.name}:{field.type}, {field.comment})")
148+
field_comment = field.comment
149+
if field_comment == '':
150+
field_list.append(f"({field.name}:{field.type})")
151+
else:
152+
field_list.append(f"({field.name}:{field.type}, {field_comment})")
143153
schema_str += ",\n".join(field_list)
144154
schema_str += '\n]\n'
145155
return schema_str

backend/common/utils/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ def extract_nested_json(text):
7676

7777
def string_to_numeric_hash(text: str, bits: Optional[int] = 64) -> int:
7878
hash_bytes = hashlib.sha256(text.encode()).digest()
79-
return int.from_bytes(hash_bytes[:bits//8], byteorder='big')
79+
hash_num = int.from_bytes(hash_bytes, byteorder='big')
80+
max_bigint = 2**63 - 1
81+
return hash_num % max_bigint
8082

8183

8284
def setup_logging():

frontend/src/i18n/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
"filter": "Filter",
295295
"batch_import": "Batch import",
296296
"add_users": "Add users",
297-
"selected_2_users": "Do you want to delete the selected 2 users?",
297+
"selected_2_users": "Do you want to delete the selected {msg} users?",
298298
"filter_conditions": "Filter conditions",
299299
"enable": "Enable",
300300
"disable": "Disable",

frontend/src/views/ds/Datasource.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ const back = () => {
328328
: $t('datasource.new_data_source')
329329
}}</span>
330330
<div v-if="!editDatasource" class="flex-center" style="width: 100%">
331-
<el-steps custom style="max-width: 500px; flex: 1" :active="activeStep" align-center>
331+
<el-steps custom style="max-width: 800px; flex: 1" :active="activeStep" align-center>
332332
<el-step>
333333
<template #title> {{ $t('qa.select_datasource') }} </template>
334334
</el-step>

frontend/src/views/system/embedded/Card.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ const handleEmbedded = () => {
6969

7070
<style lang="less" scoped>
7171
.card {
72-
width: 371px;
72+
width: 400px;
7373
height: 168px;
7474
border: 1px solid #dee0e3;
7575
padding: 16px;

frontend/src/views/system/embedded/index.vue

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -737,7 +737,9 @@ const saveHandler = () => {
737737
<template #label>
738738
<div class="private-list">
739739
{{ t('embedded.set_data_source') }}
740-
<span class="open-the_query">{{ $t('embedded.open_the_query') }} </span>
740+
<span :title="$t('embedded.open_the_query')" class="open-the_query ellipsis"
741+
>{{ $t('embedded.open_the_query') }}
742+
</span>
741743
</div>
742744
</template>
743745
<div class="card-ds_content">
@@ -971,6 +973,7 @@ const saveHandler = () => {
971973
.open-the_query {
972974
color: #ff8800;
973975
margin-left: 4px;
976+
max-width: 650px;
974977
}
975978
}
976979
@@ -1069,7 +1072,7 @@ const saveHandler = () => {
10691072
position: relative;
10701073
}
10711074
.popover-item {
1072-
height: 98px;
1075+
min-height: 98px;
10731076
display: flex;
10741077
padding-left: 8px;
10751078
padding-right: 8px;

0 commit comments

Comments
 (0)