Skip to content

Commit 2d282ef

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 152773b + b4677e0 commit 2d282ef

File tree

6 files changed

+58
-19
lines changed

6 files changed

+58
-19
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
"""008_modify_field_type
2+
3+
Revision ID: 35d925df4568
4+
Revises: ff653d5df198
5+
Create Date: 2025-05-28 12:15:28.296915
6+
7+
"""
8+
from alembic import op
9+
import sqlalchemy as sa
10+
import sqlmodel.sql.sqltypes
11+
from sqlalchemy.dialects import postgresql
12+
13+
# revision identifiers, used by Alembic.
14+
revision = '35d925df4568'
15+
down_revision = 'ff653d5df198'
16+
branch_labels = None
17+
depends_on = None
18+
19+
20+
def upgrade():
21+
# ### commands auto generated by Alembic - please adjust! ###
22+
op.alter_column('core_datasource', 'create_time',
23+
existing_type=postgresql.TIMESTAMP(timezone=True),
24+
type_=sa.DateTime(),
25+
existing_nullable=True)
26+
# ### end Alembic commands ###
27+
28+
29+
def downgrade():
30+
# ### commands auto generated by Alembic - please adjust! ###
31+
op.alter_column('core_datasource', 'create_time',
32+
existing_type=sa.DateTime(),
33+
type_=postgresql.TIMESTAMP(timezone=True),
34+
existing_nullable=True)
35+
# ### end Alembic commands ###

backend/apps/chat/schemas/chat_base_schema.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from abc import ABC, abstractmethod
44
from langchain_core.language_models import BaseLLM as LangchainBaseLLM
55
from langchain_openai import ChatOpenAI
6-
from langchain_community.llms import Tongyi, VLLM
6+
# from langchain_community.llms import Tongyi, VLLM
77

88
class LLMConfig(BaseModel):
99
"""Base configuration class for large language models"""
@@ -43,7 +43,7 @@ def _init_llm(self) -> LangchainBaseLLM:
4343
def generate(self, prompt: str) -> str:
4444
return self.llm.invoke(prompt)
4545

46-
class TongyiLLM(BaseLLM):
46+
""" class TongyiLLM(BaseLLM):
4747
def _init_llm(self) -> LangchainBaseLLM:
4848
return Tongyi(
4949
model_name=self.config.model_name,
@@ -62,16 +62,16 @@ def _init_llm(self) -> LangchainBaseLLM:
6262
)
6363
6464
def generate(self, prompt: str) -> str:
65-
return self.llm.invoke(prompt)
65+
return self.llm.invoke(prompt) """
6666

6767

6868
class LLMFactory:
6969
"""Large Language Model Factory Class"""
7070

7171
_llm_types: Dict[str, Type[BaseLLM]] = {
7272
"openai": OpenAILLM,
73-
"tongyi": TongyiLLM,
74-
"vllm": VLLMLLM
73+
"tongyi": OpenAILLM,
74+
"vllm": OpenAILLM
7575
}
7676

7777
@classmethod

backend/apps/datasource/models/datasource.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class CoreDatasource(SQLModel, table=True):
1414
type: str = Field(max_length=64)
1515
type_name: str = Field(max_length=64, nullable=True)
1616
configuration: str = Field(sa_column=Column(Text))
17-
create_time: datetime = Field(sa_column=Column(DateTime(timezone=True), nullable=True))
17+
create_time: datetime = Field(sa_column=Column(DateTime(timezone=False), nullable=True))
1818
create_by: int = Field(sa_column=Column(BigInteger()))
1919
status: str = Field(max_length=64, nullable=True)
2020

backend/apps/db/engine.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,23 @@
11
# Author: Junjun
22
# Date: 2025/5/19
3+
import urllib.parse
34
from typing import List
45

56
from sqlalchemy import create_engine, text, MetaData, Table
67
from sqlalchemy.orm import sessionmaker
78

89
from apps.datasource.models.datasource import DatasourceConf
10+
from common.core.config import settings
911

1012

1113
def get_engine_config():
12-
return DatasourceConf(username="root", password="123456", host="127.0.0.1", port=5432, database="sqlbot",
14+
return DatasourceConf(username=settings.POSTGRES_USER, password=settings.POSTGRES_PASSWORD,
15+
host="127.0.0.1", port=settings.POSTGRES_PORT, database=settings.POSTGRES_DB,
1316
dbSchema="public")
1417

1518

1619
def get_engine_uri(conf: DatasourceConf):
17-
return f"postgresql+psycopg2://{conf.username}:{conf.password}@{conf.host}:{conf.port}/{conf.database}"
20+
return f"postgresql+psycopg2://{urllib.parse.quote(conf.username)}:{urllib.parse.quote(conf.password)}@{conf.host}:{conf.port}/{urllib.parse.quote(conf.database)}"
1821

1922

2023
def get_engine_conn():

backend/pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ dependencies = [
2424
"langchain-openai>=0.3,<0.4",
2525
"langchain-community>=0.3,<0.4",
2626
"langgraph>=0.3,<0.4",
27-
"vllm>=0.8.5",
2827
"dashscope>=1.14.0,<2.0.0",
2928
"pymysql (>=1.1.1,<2.0.0)",
3029
"cryptography (>=44.0.3,<45.0.0)",

frontend/src/views/ds/form.vue

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<template>
22
<el-dialog
33
v-model="dialogVisible"
4-
:title="title"
4+
:title="dialogTitle"
55
width="600"
66
:destroy-on-close="true"
77
:close-on-click-modal="false"
88
@closed="close"
99
modal-class="add-datasource_dialog"
1010
>
11-
<template #header="{ title }">
11+
<template #header="">
1212
<div style="display: flex">
13-
<div style="margin-right: 24px">{{ title }}</div>
13+
<div style="margin-right: 24px">{{ dialogTitle }}</div>
1414
<el-steps
1515
v-show="isCreate"
1616
:active="active"
@@ -58,7 +58,7 @@
5858
:disabled="!isCreate"
5959
accept=".xls, .xlsx, .csv"
6060
:headers="headers"
61-
action="http://localhost:8000/api/v1/datasource/uploadExcel"
61+
:action="getUploadURL"
6262
:before-upload="beforeUpload"
6363
:on-success="onSuccess"
6464
>
@@ -118,7 +118,7 @@
118118
:width="560"
119119
:height="400"
120120
:scrollbarAlwaysOn="true"
121-
class-name="el-select-dropdown__list"
121+
class-name="ed-select-dropdown__list"
122122
layout="vertical"
123123
>
124124
<template #default="{ index, style }">
@@ -177,10 +177,12 @@ const isEditTable = ref(false);
177177
const checkList = ref<any>([]);
178178
const tableList = ref<any>([]);
179179
const excelUploadSuccess = ref(false);
180-
const tableListLoading = ref(true);
180+
const tableListLoading = ref(false);
181181
const token = wsCache.get("user.token");
182182
const headers = ref<any>({ "X-SQLBOT-TOKEN": `Bearer ${token}` });
183-
const title = ref("");
183+
const dialogTitle = ref("");
184+
const getUploadURL = import.meta.env.VITE_API_BASE_URL + '/datasource/uploadExcel'
185+
184186
185187
const rules = reactive<FormRules>({
186188
name: [
@@ -223,7 +225,7 @@ const close = () => {
223225
const open = (item: any, editTable: boolean = false) => {
224226
isEditTable.value = false;
225227
if (item) {
226-
title.value = "Edit Datasource";
228+
dialogTitle.value = "Edit Datasource";
227229
isCreate.value = false;
228230
form.value.id = item.id;
229231
form.value.name = item.name;
@@ -245,7 +247,7 @@ const open = (item: any, editTable: boolean = false) => {
245247
}
246248
247249
if (editTable) {
248-
title.value = "Choose Tables";
250+
dialogTitle.value = "Choose Tables";
249251
active.value = 1;
250252
isEditTable.value = true;
251253
isCreate.value = false;
@@ -278,7 +280,7 @@ const open = (item: any, editTable: boolean = false) => {
278280
});
279281
}
280282
} else {
281-
title.value = "Add Datasource";
283+
dialogTitle.value = "Add Datasource";
282284
isCreate.value = true;
283285
isEditTable.value = false;
284286
checkList.value = [];

0 commit comments

Comments
 (0)