mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-08-05 18:33:52 +00:00
WEB API independent
This commit is contained in:
parent
5f9c36a050
commit
e8c61c29e2
@ -18,6 +18,7 @@ class Config(metaclass=Singleton):
|
||||
"""Initialize the Config class"""
|
||||
|
||||
self.NEW_SERVER_MODE = False
|
||||
self.SERVER_LIGHT_MODE = False
|
||||
|
||||
# Gradio language version: en, zh
|
||||
self.LANGUAGE = os.getenv("LANGUAGE", "en")
|
||||
|
@ -3,7 +3,7 @@
|
||||
"name": "sale_report",
|
||||
"introduce": "",
|
||||
"layout": "TODO",
|
||||
"supported_chart_type":["FacetChart", "GaugeChart", "RadarChart", "Sheet", "LineChart", "PieChart", "BarChart", "PointChart", "IndicatorValue"],
|
||||
"supported_chart_type":["FacetChart", "GaugeChart", "RadarChart", "Sheet", "LineChart", "PieChart", "BarChart", "PointChart", "KeyMetrics"],
|
||||
"key_metrics":[],
|
||||
"trends": []
|
||||
}
|
@ -11,7 +11,7 @@ EXAMPLES = [
|
||||
"data": {
|
||||
"content": """{
|
||||
\"thoughts\": \"thought text\",
|
||||
\"sql\": \"SELECT city FROM users where user_name='test1'\",
|
||||
\"sql\": \"SELECT city FROM user where user_name='test1'\",
|
||||
}""",
|
||||
"example": True,
|
||||
}
|
||||
@ -26,7 +26,7 @@ EXAMPLES = [
|
||||
"data": {
|
||||
"content": """{
|
||||
\"thoughts\": \"thought text\",
|
||||
\"sql\": \"SELECT b.* FROM users a LEFT JOIN tran_order b ON a.user_name=b.user_name where a.city='成都'\",
|
||||
\"sql\": \"SELECT b.* FROM user a LEFT JOIN tran_order b ON a.user_name=b.user_name where a.city='成都'\",
|
||||
}""",
|
||||
"example": True,
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ class DbChatOutputParser(BaseOutputParser):
|
||||
if len(data) <= 1:
|
||||
data.insert(0, ["result"])
|
||||
df = pd.DataFrame(data[1:], columns=data[0])
|
||||
if not CFG.NEW_SERVER_MODE:
|
||||
if not CFG.NEW_SERVER_MODE and not CFG.SERVER_LIGHT_MODE:
|
||||
table_style = """<style>
|
||||
table{border-collapse:collapse;width:100%;height:80%;margin:0 auto;float:center;border: 1px solid #007bff; background-color:#333; color:#fff}th,td{border:1px solid #ddd;padding:3px;text-align:center}th{background-color:#C9C3C7;color: #fff;font-weight: bold;}tr:nth-child(even){background-color:#444}tr:hover{background-color:#444}
|
||||
</style>"""
|
||||
|
@ -103,7 +103,8 @@ if __name__ == "__main__":
|
||||
from pilot.server.llmserver import worker
|
||||
worker.start_check()
|
||||
CFG.NEW_SERVER_MODE = True
|
||||
|
||||
else:
|
||||
CFG.SERVER_LIGHT_MODE = True
|
||||
|
||||
import uvicorn
|
||||
uvicorn.run(app, host="0.0.0.0", port=args.port)
|
||||
|
Loading…
Reference in New Issue
Block a user