feat(editor): ChatExcel

ChatExcel devlop part 2
This commit is contained in:
yhjun1026 2023-08-21 19:18:10 +08:00
parent 29be096a96
commit 5bbe47d715
122 changed files with 352 additions and 827 deletions

View File

@ -1,56 +0,0 @@
from pilot.commands.command_mange import command
from pilot.configs.config import Config
import pandas as pd
import base64
import io
import matplotlib
import seaborn as sns
matplotlib.use("Agg")
import matplotlib.pyplot as plt
from pilot.configs.model_config import LOGDIR
from pilot.utils import build_logger
CFG = Config()
logger = build_logger("show_chart_gen", LOGDIR + "show_chart_gen.log")
@command("response_line_chart", "Use line chart to display SQL data", '"speak": "<speak>", "sql":"<sql>","db_name":"<db_name>"')
def response_line_chart(speak: str, sql: str, db_name: str) -> str:
logger.info(f"response_line_chart:{speak},{sql},{db_name}")
df = pd.read_sql(sql, CFG.LOCAL_DB_MANAGE.get_connect(db_name))
columns = df.columns.tolist()
if df.size <= 0:
raise ValueError("No Data" + sql)
plt.rcParams["font.family"] = ["sans-serif"]
rc = {"font.sans-serif": "SimHei", "axes.unicode_minus": False}
sns.set(context="notebook", style="ticks", color_codes=True, rc=rc)
plt.subplots(figsize=(8, 5), dpi=100)
sns.barplot(df, x=columns[0], y=columns[1])
plt.title("")
buf = io.BytesIO()
plt.savefig(buf, format="png", dpi=100)
buf.seek(0)
data = base64.b64encode(buf.getvalue()).decode("ascii")
html_img = f"""<h5>{speak}</h5><img style='max-width: 120%; max-height: 80%;' src="data:image/png;base64,{data}" />"""
return html_img
@command("response_bar_chart", "Use bar chart to display SQL data", '"speak": "<speak>", "sql":"<sql>","db_name":"<db_name>"')
def response_bar_chart(speak: str, sql: str, db_name: str) -> str:
"""
"""
pass
@command("response_pie_chart", "Use pie chart to display SQL data", '"speak": "<speak>", "sql":"<sql>","db_name":"<db_name>"')
def response_pie_chart(speak: str, sql: str, db_name: str) -> str:
"""
"""
pass

View File

@ -1,21 +0,0 @@
import pandas as pd
from pilot.commands.command_mange import command
from pilot.configs.config import Config
from pilot.configs.model_config import LOGDIR
from pilot.utils import build_logger
CFG = Config()
logger = build_logger("show_table_gen", LOGDIR + "show_table_gen.log")
@command("response_table", "Use table to display SQL data", '"speak": "<speak>", "sql":"<sql>","db_name":"<db_name>"')
def response_table(speak: str, sql: str, db_name: str) -> str:
logger.info(f"response_table:{speak},{sql},{db_name}")
df = pd.read_sql(sql, CFG.LOCAL_DB_MANAGE.get_connect(db_name))
html_table = df.to_html(index=False, escape=False, sparsify=False)
table_str = "".join(html_table.split())
html = f"""<div class="w-full overflow-auto">{table_str}</div>"""
view_text = f"##### {str(speak)}" + "\n" + html.replace("\n", " ")
return view_text

View File

@ -1,33 +0,0 @@
import pandas as pd
from pilot.commands.command_mange import command
from pilot.configs.config import Config
from pilot.configs.model_config import LOGDIR
from pilot.utils import build_logger
CFG = Config()
logger = build_logger("show_table_gen", LOGDIR + "show_table_gen.log")
@command("response_data_text", "Use text to display SQL data",
'"speak": "<speak>", "sql":"<sql>","db_name":"<db_name>"')
def response_data_text(speak: str, sql: str, db_name: str) -> str:
logger.info(f"response_data_text:{speak},{sql},{db_name}")
df = pd.read_sql(sql, CFG.LOCAL_DB_MANAGE.get_connect(db_name))
data = df.values
row_size = data.shape[0]
value_str, text_info = ""
if row_size > 1:
html_table = df.to_html(index=False, escape=False, sparsify=False)
table_str = "".join(html_table.split())
html = f"""<div class="w-full overflow-auto">{table_str}</div>"""
text_info = f"##### {str(speak)}" + "\n" + html.replace("\n", " ")
elif row_size == 1:
row = data[0]
for value in row:
value_str = value_str + f", ** {value} **"
text_info = f"{speak}: {value_str}"
else:
text_info = f"##### {speak}: _没有找到可用的数据_"
return text_info

View File

@ -17,7 +17,7 @@ CFG = Config()
logger = build_logger("show_chart_gen", LOGDIR + "show_chart_gen.log")
@command("response_line_chart", "Use line chart to display SQL data", '"speak": "<speak>", "df":"<data frame>"')
@command("response_line_chart", "Line chart display, used to display comparative trend analysis data", '"speak": "<speak>", "df":"<data frame>"')
def response_line_chart(speak: str, df: DataFrame) -> str:
logger.info(f"response_line_chart:{speak},")
@ -27,9 +27,10 @@ def response_line_chart(speak: str, df: DataFrame) -> str:
raise ValueError("No Data")
plt.rcParams["font.family"] = ["sans-serif"]
rc = {"font.sans-serif": "SimHei", "axes.unicode_minus": False}
sns.set_style(rc={'font.sans-serif': "Microsoft Yahei"})
sns.set(context="notebook", style="ticks", color_codes=True, rc=rc)
plt.subplots(figsize=(8, 5), dpi=100)
sns.barplot(df, x=columns[0], y=columns[1])
sns.lineplot(df, x=columns[0], y=columns[1])
plt.title("")
buf = io.BytesIO()
@ -37,20 +38,54 @@ def response_line_chart(speak: str, df: DataFrame) -> str:
buf.seek(0)
data = base64.b64encode(buf.getvalue()).decode("ascii")
html_img = f"""<h5>{speak}</h5><img style='max-width: 120%; max-height: 80%;' src="data:image/png;base64,{data}" />"""
html_img = f"""<h5>{speak}</h5><img style='max-width: 100%; max-height: 70%;' src="data:image/png;base64,{data}" />"""
return html_img
# @command("response_bar_chart", "Use bar chart to display SQL data", '"speak": "<speak>", "sql":"<sql>","db_name":"<db_name>"')
# def response_bar_chart(speak: str, sql: str, db_name: str) -> str:
# """
# """
# pass
#
#
# @command("response_pie_chart", "Use pie chart to display SQL data", '"speak": "<speak>", "sql":"<sql>","db_name":"<db_name>"')
# def response_pie_chart(speak: str, sql: str, db_name: str) -> str:
# """
# """
# pass
@command("response_bar_chart", "Histogram, suitable for comparative analysis of multiple target values", '"speak": "<speak>", "df":"<data frame>"')
def response_bar_chart(speak: str, df: DataFrame) -> str:
logger.info(f"response_bar_chart:{speak},")
columns = df.columns.tolist()
if df.size <= 0:
raise ValueError("No Data")
plt.rcParams["font.family"] = ["sans-serif"]
rc = {"font.sans-serif": "SimHei", "axes.unicode_minus": False}
sns.set_style(rc={'font.sans-serif': "Microsoft Yahei"})
sns.set(context="notebook", style="ticks", color_codes=True, rc=rc)
plt.subplots(figsize=(8, 5), dpi=100)
sns.barplot(df, x=df[columns[0]], y=df[columns[1]])
plt.title("")
buf = io.BytesIO()
plt.savefig(buf, format="png", dpi=100)
buf.seek(0)
data = base64.b64encode(buf.getvalue()).decode("ascii")
html_img = f"""<h5>{speak}</h5><img style='max-width: 100%; max-height: 70%;' src="data:image/png;base64,{data}" />"""
return html_img
@command("response_pie_chart", "Pie chart, suitable for scenarios such as proportion and distribution statistics", '"speak": "<speak>", "df":"<data frame>"')
def response_pie_chart(speak: str, df: DataFrame) -> str:
logger.info(f"response_pie_chart:{speak},")
columns = df.columns.tolist()
if df.size <= 0:
raise ValueError("No Data")
plt.rcParams["font.family"] = ["sans-serif"]
rc = {"font.sans-serif": "SimHei", "axes.unicode_minus": False}
sns.set_style(rc={'font.sans-serif': "Microsoft Yahei"})
sns.set(context="notebook", style="ticks", color_codes=True, rc=rc)
sns.set_palette("Set3") # 设置颜色主题
plt.pie(columns[1], labels=columns[0], autopct='%1.1f%%', startangle=90)
plt.axis('equal') # 使饼图为正圆形
plt.title(columns[0])
buf = io.BytesIO()
plt.savefig(buf, format="png", dpi=100)
buf.seek(0)
data = base64.b64encode(buf.getvalue()).decode("ascii")
html_img = f"""<h5>{speak}</h5><img style='max-width: 100%; max-height: 70%;' src="data:image/png;base64,{data}" />"""
return html_img

View File

@ -11,7 +11,7 @@ CFG = Config()
logger = build_logger("show_table_gen", LOGDIR + "show_table_gen.log")
@command("response_table", "Use table to display SQL data", '"speak": "<speak>", "df":"<data frame>"')
@command("response_table", "Table display, suitable for display with many display columns or non-numeric columns", '"speak": "<speak>", "df":"<data frame>"')
def response_table(speak: str, df: DataFrame) -> str:
logger.info(f"response_table:{speak}")
html_table = df.to_html(index=False, escape=False, sparsify=False)

View File

@ -10,7 +10,7 @@ CFG = Config()
logger = build_logger("show_table_gen", LOGDIR + "show_table_gen.log")
@command("response_data_text", "Use text to display data",
@command("response_data_text", "Text display, the default display method, suitable for single-line or simple content display",
'"speak": "<speak>", "df":"<data frame>"')
def response_data_text(speak: str, df: DataFrame) -> str:
logger.info(f"response_data_text:{speak}")

View File

@ -126,7 +126,7 @@ class ConnectManager:
db_user = db_config.get("db_user")
db_pwd = db_config.get("db_pwd")
return connect_instance.from_uri_db(
db_host, db_port, db_user, db_pwd, db_name
host=db_host, port=db_port, user=db_user, pwd=db_pwd, db_name=db_name
)
def get_db_list(self):

View File

@ -95,13 +95,13 @@ class RDBMSDatabase(BaseConnect):
db_url: str = (
cls.driver
+ "://"
+ CFG.LOCAL_DB_USER
+ user
+ ":"
+ CFG.LOCAL_DB_PASSWORD
+ pwd
+ "@"
+ CFG.LOCAL_DB_HOST
+ host
+ ":"
+ str(CFG.LOCAL_DB_PORT)
+ str(port)
+ "/"
+ db_name
)

View File

@ -2,6 +2,8 @@
import json
import os.path
import re
import json
from datetime import datetime
from jsonschema import Draft7Validator
@ -79,3 +81,10 @@ def is_string_valid_json(json_string: str, schema_name: str) -> bool:
"""
return validate_json_string(json_string, schema_name) is not None
class DateTimeEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, datetime):
return obj.isoformat()
return super().default(obj)

View File

@ -139,6 +139,7 @@ async def dialogue_scenes():
scene_vos: List[ChatSceneVo] = []
new_modes: List[ChatScene] = [
ChatScene.ChatWithDbExecute,
ChatScene.ChatExcel,
ChatScene.ChatWithDbQA,
ChatScene.ChatKnowledge,
ChatScene.ChatDashboard,
@ -229,9 +230,10 @@ async def chat_prepare(dialogue: ConversationVo = Body()):
logger.info(f"chat_prepare:{dialogue}")
## check conv_uid
chat: BaseChat = get_chat_instance(dialogue)
if not chat.history_message:
if len(chat.history_message) >0:
return Result.succ(None)
return Result.succ(chat.prepare())
resp = chat.prepare()
return Result.succ(resp)
@router.post("/v1/chat/completions")

View File

@ -33,7 +33,7 @@ class ChatScene(Enum):
code = "excel_learning",
name = "Excel Learning",
describe = "Analyze and summarize your excel files.",
param_types = [],
param_types=["File Select"],
is_inner = True,
)
ChatExcel = Scene(

View File

@ -85,7 +85,7 @@ class BaseChat(ABC):
proxyllm_backend=CFG.PROXYLLM_BACKEND,
)
)
if not chat_mode.is_inner():
### can configurable storage methods
self.memory = DuckdbHistoryMemory(chat_session_id)
@ -181,7 +181,6 @@ class BaseChat(ABC):
return response
else:
from pilot.server.llmserver import worker
return worker.generate_stream_gate(payload)
except Exception as e:
print(traceback.format_exc())

View File

@ -1,6 +1,8 @@
import json
import os
from typing import List, Any, Dict
from pilot.scene.base_message import (
HumanMessage,
ViewMessage,
@ -12,21 +14,19 @@ from pilot.configs.config import Config
from pilot.common.markdown_text import (
generate_htm_table,
)
from pilot.scene.chat_data.chat_excel.excel_learning.prompt import prompt
from pilot.scene.chat_data.chat_excel.excel_analyze.prompt import prompt
from pilot.scene.chat_data.chat_excel.excel_reader import ExcelReader
from pilot.scene.chat_data.chat_excel.excel_learning.chat import ExcelLearning
CFG = Config()
class ExcelLearning(BaseChat):
class ChatExcel(BaseChat):
chat_scene: str = ChatScene.ChatExcel.value()
chat_retention_rounds = 2
def __init__(self, chat_session_id, user_input, select_param: str = ""):
chat_mode = ChatScene.ChatExcel
self.excel_file_path = select_param
file_name, file_extension = os.path.splitext(select_param)
self.excel_file_name = file_name
self.excel_reader = ExcelReader(select_param)
super().__init__(
@ -36,10 +36,40 @@ class ExcelLearning(BaseChat):
select_param=select_param,
)
def _generate_command_string(self, command: Dict[str, Any]) -> str:
"""
Generate a formatted string representation of a command.
Args:
command (dict): A dictionary containing command information.
Returns:
str: The formatted command string.
"""
args_string = ", ".join(
f'"{key}": "{value}"' for key, value in command["args"].items()
)
return f'{command["label"]}: "{command["name"]}", args: {args_string}'
def _generate_numbered_list(self) -> str:
command_strings = []
if CFG.command_disply:
command_strings += [
str(item)
for item in CFG.command_disply.commands.values()
if item.enabled
]
return "\n".join(f"{i+1}. {item}" for i, item in enumerate(command_strings))
def generate_input_values(self):
input_values = {
"data_example": json.dumps(self.excel_reader.get_sample_data()),
"user_input": self.current_user_input,
"table_name": self.excel_reader.table_name,
"disply_type": self._generate_numbered_list(),
}
return input_values
@ -47,19 +77,21 @@ class ExcelLearning(BaseChat):
logger.info(f"{self.chat_mode} prepare start!")
chat_param = {
"chat_session_id": self.chat_session_id,
"user_input": self.excel_file_name + " analysis",
"user_input": self.excel_reader.excel_file_name + " analysis",
"select_param": self.excel_file_path
}
chat: BaseChat = ExcelLearning(**chat_param)
return chat.call()
learn_chat = ExcelLearning(**chat_param)
result = learn_chat.nostream_call()
return result
def do_action(self, prompt_response):
print(f"do_action:{prompt_response}")
param= {
"speak": prompt_response["thoughts"],
"df": self.excel_reader.get_df_by_sql(prompt_response["sql"])
}
return CFG.command_disply.call(prompt_response['display'], **param)
# colunms, datas = self.excel_reader.run(prompt_response.sql)
param= {
"speak": prompt_response.thoughts,
"df": self.excel_reader.get_df_by_sql_ex(prompt_response.sql)
}
return CFG.command_disply.call(prompt_response.display, **param)

View File

@ -33,9 +33,9 @@ class ChatExcelOutputParser(BaseOutputParser):
sql = response[key]
if key.strip() == "thoughts":
thoughts = response[key]
if key.strip() == "disply":
disply = response[key]
return ExcelAnalyzeResponse(sql, thoughts, disply)
if key.strip() == "display":
display = response[key]
return ExcelAnalyzeResponse(sql, thoughts, display)
def parse_view_response(self, speak, data) -> str:
### tool out data to table view

View File

@ -2,7 +2,7 @@ import json
from pilot.prompts.prompt_new import PromptTemplate
from pilot.configs.config import Config
from pilot.scene.base import ChatScene
from pilot.scene.chat_db.auto_execute.out_parser import DbChatOutputParser, SqlAction
from pilot.scene.chat_data.chat_excel.excel_analyze.out_parser import ChatExcelOutputParser
from pilot.common.schema import SeparatorStyle
CFG = Config()
@ -10,11 +10,14 @@ CFG = Config()
PROMPT_SCENE_DEFINE = "You are a data analysis expert. "
_DEFAULT_TEMPLATE = """
Please give data analysis SQL based on the following user goals: {user_input}
Please use the data structure information of the above historical dialogue, make sure not to use column names that are not in the data structure.
According to the user goal: {user_input}give the correct duckdb SQL for data analysis.
Use the table name: {table_name}
According to the analysis SQL obtained by the user's goal, select the best one from the following display forms, if it cannot be determined, use Text as the display.
Display type:
{disply_type}
According to the analysis SQL obtained by the user's goal, select the best one from the following display forms, if it cannot be determined, use Text as the display.
Respond in the following json format:
{response}
Ensure the response is correct json and can be parsed by Python json.loads
@ -39,14 +42,15 @@ PROMPT_TEMPERATURE = 0.8
prompt = PromptTemplate(
template_scene=ChatScene.ChatExcel.value(),
input_variables=["user_input", "disply_type"],
input_variables=["user_input", "table_name", "disply_type"],
response_format=json.dumps(RESPONSE_FORMAT_SIMPLE, ensure_ascii=False, indent=4),
template_define=PROMPT_SCENE_DEFINE,
template=_DEFAULT_TEMPLATE,
stream_out=PROMPT_NEED_NEED_STREAM_OUT,
output_parser=DbChatOutputParser(
output_parser=ChatExcelOutputParser(
sep=PROMPT_SEP, is_stream_out=PROMPT_NEED_NEED_STREAM_OUT
),
need_historical_messages = True,
# example_selector=sql_data_example,
temperature=PROMPT_TEMPERATURE,
)

View File

@ -1,4 +1,5 @@
import json
import os
from pilot.scene.base_message import (
HumanMessage,
@ -13,6 +14,7 @@ from pilot.common.markdown_text import (
)
from pilot.scene.chat_data.chat_excel.excel_learning.prompt import prompt
from pilot.scene.chat_data.chat_excel.excel_reader import ExcelReader
from pilot.json_utils.utilities import DateTimeEncoder
CFG = Config()
@ -20,15 +22,16 @@ CFG = Config()
class ExcelLearning(BaseChat):
chat_scene: str = ChatScene.ExcelLearning.value()
def __init__(self, chat_session_id, user_input, file_path):
chat_mode = ChatScene.ChatWithDbExecute
def __init__(self, chat_session_id, user_input, select_param:str=None):
chat_mode = ChatScene.ExcelLearning
""" """
self.excel_reader = ExcelReader(file_path)
self.excel_file_path = select_param
self.excel_reader = ExcelReader(select_param)
super().__init__(
chat_mode=chat_mode,
chat_session_id=chat_session_id,
current_user_input = user_input,
select_param=file_path,
select_param=select_param,
)
@ -38,7 +41,7 @@ class ExcelLearning(BaseChat):
datas.insert(0, colunms)
input_values = {
"data_example": datas,
"data_example": json.dumps(self.excel_reader.get_sample_data(), cls=DateTimeEncoder),
}
return input_values

View File

@ -20,7 +20,7 @@ class ExcelResponse(NamedTuple):
logger = build_logger("chat_excel", LOGDIR + "ChatExcel.log")
class ChatExcelOutputParser(BaseOutputParser):
class LearningExcelOutputParser(BaseOutputParser):
def __init__(self, sep: str, is_stream_out: bool):
super().__init__(sep=sep, is_stream_out=is_stream_out)
@ -39,27 +39,15 @@ class ChatExcelOutputParser(BaseOutputParser):
def parse_view_response(self, speak, data) -> str:
### tool out data to table view
html_title= data["desciption"]
html_colunms= f"<h5>数据结构</h5><ul>"
for item in data["clounms"]:
html_colunms = html_colunms + "<li>"
html_title = f"### **数据简介:**\n{data.desciption} \n"
html_colunms = f"### **数据结构:**\n"
for item in data.clounms:
keys = item.keys()
for key in keys:
html_colunms = html_colunms + f"{key}:{item[key]}"
html_colunms = html_colunms + "</li>"
html_colunms= html_colunms + "</ul>"
html_colunms = html_colunms + f"- **{key}**:{item[key]} \n"
html_plans="<ol>"
for item in data["plans"]:
html_plans = html_plans + f"<li>{item}</li>"
html = f"""
<div>
<h4>{html_title}</h4>
<div>{html_colunms}</div>
<div>{html_plans}</div>
<div>
"""
html_plans = f"\n ### **分析计划:** \n"
for item in data.plans:
html_plans = html_plans + f"- {item} \n"
html = f"""{html_title}{html_colunms}{html_plans}"""
return html

View File

@ -2,7 +2,7 @@ import json
from pilot.prompts.prompt_new import PromptTemplate
from pilot.configs.config import Config
from pilot.scene.base import ChatScene
from pilot.scene.chat_db.auto_execute.out_parser import DbChatOutputParser, SqlAction
from pilot.scene.chat_data.chat_excel.excel_learning.out_parser import LearningExcelOutputParser
from pilot.common.schema import SeparatorStyle
CFG = Config()
@ -21,7 +21,7 @@ Please return your answer in JSON format, the return format is as follows:
RESPONSE_FORMAT_SIMPLE = {
"DataAnalysis": "数据内容分析总结",
"Colunm Analysis": [{"colunm name": "字段介绍,专业术语解释(请尽量简单明了)"}],
"ColumnAnalysis": [{"column name1": "字段1介绍,专业术语解释(请尽量简单明了)"}],
"AnalysisProgram": ["1.分析方案1图表展示方式1", "2.分析方案2图表展示方式2"],
}
@ -43,7 +43,7 @@ prompt = PromptTemplate(
template_define=PROMPT_SCENE_DEFINE,
template=_DEFAULT_TEMPLATE,
stream_out=PROMPT_NEED_NEED_STREAM_OUT,
output_parser=DbChatOutputParser(
output_parser=LearningExcelOutputParser(
sep=PROMPT_SEP, is_stream_out=PROMPT_NEED_NEED_STREAM_OUT
),
# example_selector=sql_data_example,

View File

@ -6,79 +6,88 @@ import time
from fsspec import filesystem
import spatial
from pilot.scene.chat_data.chat_excel.excel_reader import ExcelReader
if __name__ == "__main__":
# connect = duckdb.connect("/Users/tuyang.yhj/Downloads/example.xlsx")
#
excel_reader = ExcelReader("/Users/tuyang.yhj/Downloads/example.xlsx")
def csv_colunm_foramt(val):
if str(val).find("$") >= 0:
return float(val.replace('$', '').replace(',', ''))
if str(val).find("¥") >= 0:
return float(val.replace('¥', '').replace(',', ''))
return val
# colunms, datas = excel_reader.run( "SELECT CONCAT(Year, '-', Quarter) AS QuarterYear, SUM(Sales) AS TotalSales FROM example GROUP BY QuarterYear ORDER BY QuarterYear")
colunms, datas = excel_reader.run( """ SELECT Month_Name, SUM(Sales) AS Total_Sales FROM example WHERE Year = '2019' GROUP BY Month_Name """)
# 获取当前时间戳,作为代码开始的时间
start_time = int(time.time() * 1000)
df = pd.read_excel('/Users/tuyang.yhj/Downloads/example.xlsx')
# 读取 Excel 文件为 Pandas DataFrame
df = pd.read_excel('/Users/tuyang.yhj/Downloads/example.xlsx', converters={i: csv_colunm_foramt for i in range(df.shape[1])})
# d = df.values
# print(d.shape[0])
# for row in d:
# print(row[0])
# print(len(row))
# r = df.iterrows()
# 获取当前时间戳,作为代码结束的时间
end_time = int(time.time() * 1000)
print(f"耗时:{(end_time-start_time)/1000}")
# 连接 DuckDB 数据库
con = duckdb.connect(database=':memory:', read_only=False)
# 将 DataFrame 写入 DuckDB 数据库中的一个表
con.register('example', df)
# 查询 DuckDB 数据库中的表
conn = con.cursor()
results = con.execute('SELECT Country, SUM(Profit) AS Total_Profit FROM example GROUP BY Country ORDER BY Total_Profit DESC LIMIT 1;')
colunms = []
for descrip in results.description:
colunms.append(descrip[0])
print(colunms)
for row in results.fetchall():
print(row)
# 连接 DuckDB 数据库
# con = duckdb.connect(':memory:')
# # 加载 spatial 扩展
# con.execute('install spatial;')
# con.execute('load spatial;')
#
# # 查询 duckdb_internal 系统表,获取扩展列表
# result = con.execute("SELECT * FROM duckdb_internal.functions WHERE schema='list_extensions';")
#
# # 遍历查询结果,输出扩展名称和版本号
# for row in result:
# print(row['name'], row['return_type'])
# duckdb.read_csv('/Users/tuyang.yhj/Downloads/example_csc.csv')
# result = duckdb.sql('SELECT * FROM "/Users/tuyang.yhj/Downloads/yhj-zx.csv" ')
# result = duckdb.sql('SELECT * FROM "/Users/tuyang.yhj/Downloads/example_csc.csv" limit 20')
# for row in result.fetchall():
# print(row)
# result = con.execute("SELECT * FROM st_read('/Users/tuyang.yhj/Downloads/example.xlsx', layer='Sheet1')")
# # 遍历查询结果
# for row in result.fetchall():
# print(row)
print("xx")
#
#
# def csv_colunm_foramt(val):
# if str(val).find("$") >= 0:
# return float(val.replace('$', '').replace(',', ''))
# if str(val).find("¥") >= 0:
# return float(val.replace('¥', '').replace(',', ''))
# return val
#
# # 获取当前时间戳,作为代码开始的时间
# start_time = int(time.time() * 1000)
#
# df = pd.read_excel('/Users/tuyang.yhj/Downloads/example.xlsx')
# # 读取 Excel 文件为 Pandas DataFrame
# df = pd.read_excel('/Users/tuyang.yhj/Downloads/example.xlsx', converters={i: csv_colunm_foramt for i in range(df.shape[1])})
#
# # d = df.values
# # print(d.shape[0])
# # for row in d:
# # print(row[0])
# # print(len(row))
# # r = df.iterrows()
#
# # 获取当前时间戳,作为代码结束的时间
# end_time = int(time.time() * 1000)
#
# print(f"耗时:{(end_time-start_time)/1000}秒")
#
# # 连接 DuckDB 数据库
# con = duckdb.connect(database=':memory:', read_only=False)
#
# # 将 DataFrame 写入 DuckDB 数据库中的一个表
# con.register('example', df)
#
# # 查询 DuckDB 数据库中的表
# conn = con.cursor()
# results = con.execute('SELECT Country, SUM(Profit) AS Total_Profit FROM example GROUP BY Country ORDER BY Total_Profit DESC LIMIT 1;')
# colunms = []
# for descrip in results.description:
# colunms.append(descrip[0])
# print(colunms)
# for row in results.fetchall():
# print(row)
#
#
# # 连接 DuckDB 数据库
# # con = duckdb.connect(':memory:')
#
# # # 加载 spatial 扩展
# # con.execute('install spatial;')
# # con.execute('load spatial;')
# #
# # # 查询 duckdb_internal 系统表,获取扩展列表
# # result = con.execute("SELECT * FROM duckdb_internal.functions WHERE schema='list_extensions';")
# #
# # # 遍历查询结果,输出扩展名称和版本号
# # for row in result:
# # print(row['name'], row['return_type'])
# # duckdb.read_csv('/Users/tuyang.yhj/Downloads/example_csc.csv')
# # result = duckdb.sql('SELECT * FROM "/Users/tuyang.yhj/Downloads/yhj-zx.csv" ')
# # result = duckdb.sql('SELECT * FROM "/Users/tuyang.yhj/Downloads/example_csc.csv" limit 20')
# # for row in result.fetchall():
# # print(row)
#
#
# # result = con.execute("SELECT * FROM st_read('/Users/tuyang.yhj/Downloads/example.xlsx', layer='Sheet1')")
# # # 遍历查询结果
# # for row in result.fetchall():
# # print(row)
# print("xx")
#
#
#

View File

@ -1,19 +1,35 @@
import duckdb
import os
import pandas as pd
from pilot.common.pd_utils import csv_colunm_foramt
def excel_colunm_format(old_name:str)->str:
new_column = old_name.strip()
new_column = new_column.replace(" ", "_")
return new_column
class ExcelReader:
def __init__(self, file_path):
# read excel filt
df_tmp = pd.read_excel(file_path)
self.df = pd.read_excel(file_path, converters={i: csv_colunm_foramt for i in range(df_tmp.shape[1])})
self.columns_map = {}
for column_name in df_tmp.columns:
self.columns_map.update({column_name: excel_colunm_format(column_name)})
self.df = self.df.rename(columns=lambda x: x.strip().replace(' ', '_'))
# connect DuckDB
self.db = duckdb.connect(database=':memory:', read_only=False)
file_name = os.path.basename(file_path)
file_name_without_extension = os.path.splitext(file_name)[0]
self.table_name = f"excel"
self.excel_file_name = file_name_without_extension
self.table_name = file_name_without_extension
# write data in duckdb
self.db.register(self.table_name, self.df)

View File

@ -9,6 +9,7 @@ from pilot.scene.chat_db.auto_execute.chat import ChatWithDbAutoExecute
from pilot.scene.chat_dashboard.chat import ChatDashboard
from pilot.scene.chat_knowledge.v1.chat import ChatKnowledge
from pilot.scene.chat_knowledge.inner_db_summary.chat import InnerChatDBSummary
from pilot.scene.chat_data.chat_excel.excel_analyze.chat import ChatExcel
class ChatFactory(metaclass=Singleton):

View File

@ -75,7 +75,7 @@ app.include_router(knowledge_router, prefix="/api")
app.include_router(api_editor_route_v1, prefix="/api")
# app.include_router(api_v1)
# app.include_router(knowledge_router)
app.include_router(knowledge_router)
# app.include_router(api_editor_route_v1)
app.mount("/_next/static", StaticFiles(directory=static_file_path + "/_next/static"))

View File

@ -1 +1 @@
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>404: This page could not be found</title><meta name="next-head-count" content="3"/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-ea98197dd6536d07.js" defer=""></script><script src="/_next/static/chunks/framework-4498e84bb0ba1830.js" defer=""></script><script src="/_next/static/chunks/main-74fdb7a2c21bf459.js" defer=""></script><script src="/_next/static/chunks/pages/_app-8fa61e72220a040a.js" defer=""></script><script src="/_next/static/chunks/pages/_error-bcb3296e330590f7.js" defer=""></script><script src="/_next/static/8J6oF0PtATupjimCxWfXw/_buildManifest.js" defer=""></script><script src="/_next/static/8J6oF0PtATupjimCxWfXw/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"8J6oF0PtATupjimCxWfXw","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>404: This page could not be found</title><meta name="next-head-count" content="3"/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-e4cf89f137f492b8.js" defer=""></script><script src="/_next/static/chunks/framework-4498e84bb0ba1830.js" defer=""></script><script src="/_next/static/chunks/main-74fdb7a2c21bf459.js" defer=""></script><script src="/_next/static/chunks/pages/_app-8fa61e72220a040a.js" defer=""></script><script src="/_next/static/chunks/pages/_error-bcb3296e330590f7.js" defer=""></script><script src="/_next/static/ae8AMgI-SPy2zYTXfjFnE/_buildManifest.js" defer=""></script><script src="/_next/static/ae8AMgI-SPy2zYTXfjFnE/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"ae8AMgI-SPy2zYTXfjFnE","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>

View File

@ -1 +1 @@
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>404: This page could not be found</title><meta name="next-head-count" content="3"/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-ea98197dd6536d07.js" defer=""></script><script src="/_next/static/chunks/framework-4498e84bb0ba1830.js" defer=""></script><script src="/_next/static/chunks/main-74fdb7a2c21bf459.js" defer=""></script><script src="/_next/static/chunks/pages/_app-8fa61e72220a040a.js" defer=""></script><script src="/_next/static/chunks/pages/_error-bcb3296e330590f7.js" defer=""></script><script src="/_next/static/8J6oF0PtATupjimCxWfXw/_buildManifest.js" defer=""></script><script src="/_next/static/8J6oF0PtATupjimCxWfXw/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"8J6oF0PtATupjimCxWfXw","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>404: This page could not be found</title><meta name="next-head-count" content="3"/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-e4cf89f137f492b8.js" defer=""></script><script src="/_next/static/chunks/framework-4498e84bb0ba1830.js" defer=""></script><script src="/_next/static/chunks/main-74fdb7a2c21bf459.js" defer=""></script><script src="/_next/static/chunks/pages/_app-8fa61e72220a040a.js" defer=""></script><script src="/_next/static/chunks/pages/_error-bcb3296e330590f7.js" defer=""></script><script src="/_next/static/ae8AMgI-SPy2zYTXfjFnE/_buildManifest.js" defer=""></script><script src="/_next/static/ae8AMgI-SPy2zYTXfjFnE/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,&quot;Segoe UI&quot;,Roboto,Helvetica,Arial,sans-serif,&quot;Apple Color Emoji&quot;,&quot;Segoe UI Emoji&quot;;height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">This page could not be found<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":404}},"page":"/_error","query":{},"buildId":"ae8AMgI-SPy2zYTXfjFnE","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>

View File

@ -1 +0,0 @@
self.__BUILD_MANIFEST={__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-f5357f382422dd96.js"],sortedPages:["/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();

View File

@ -1 +0,0 @@
self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()

View File

@ -1 +0,0 @@
self.__BUILD_MANIFEST={__rewrites:{beforeFiles:[],afterFiles:[],fallback:[]},"/_error":["static/chunks/pages/_error-bcb3296e330590f7.js"],sortedPages:["/_app","/_error"]},self.__BUILD_MANIFEST_CB&&self.__BUILD_MANIFEST_CB();

View File

@ -1 +0,0 @@
self.__SSG_MANIFEST=new Set([]);self.__SSG_MANIFEST_CB&&self.__SSG_MANIFEST_CB()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[538],{40687:function(e,t,n){Promise.resolve().then(n.bind(n,26257))},26257:function(e,t,n){"use strict";n.r(t);var r=n(9268),a=n(56008),i=n(86006),c=n(78635),s=n(90545),o=n(80937),l=n(44334),d=n(311),h=n(22046),u=n(83192),g=n(23910),f=n(29766),j=n(78915);t.default=()=>{let e=(0,a.useRouter)(),{mode:t}=(0,c.tv)(),n=(0,a.useSearchParams)().get("spacename"),m=(0,a.useSearchParams)().get("documentid"),[p,x]=(0,i.useState)(0),[P,b]=(0,i.useState)(0),[S,Z]=(0,i.useState)([]);return(0,i.useEffect)(()=>{(async function(){let e=await (0,j.PR)("/knowledge/".concat(n,"/chunk/list"),{document_id:m,page:1,page_size:20});e.success&&(Z(e.data.data),x(e.data.total),b(e.data.page))})()},[]),(0,r.jsxs)(s.Z,{className:"p-4",sx:{"&":{height:"90%"}},children:[(0,r.jsx)(o.Z,{direction:"row",justifyContent:"flex-start",alignItems:"center",sx:{marginBottom:"20px"},children:(0,r.jsxs)(l.Z,{"aria-label":"breadcrumbs",children:[(0,r.jsx)(d.Z,{onClick:()=>{e.push("/datastores")},underline:"hover",color:"neutral",fontSize:"inherit",children:"Knowledge Space"},"Knowledge Space"),(0,r.jsx)(d.Z,{onClick:()=>{e.push("/datastores/documents?name=".concat(n))},underline:"hover",color:"neutral",fontSize:"inherit",children:"Documents"},"Knowledge Space"),(0,r.jsx)(h.ZP,{fontSize:"inherit",children:"Chunks"})]})}),(0,r.jsx)(s.Z,{className:"p-4",sx:{"&":{height:"90%",overflow:"auto"},"&::-webkit-scrollbar":{display:"none"}},children:S.length?(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(u.Z,{color:"primary",variant:"plain",size:"lg",sx:{"& tbody tr: hover":{backgroundColor:"light"===t?"rgb(246, 246, 246)":"rgb(33, 33, 40)"},"& tbody tr: hover a":{textDecoration:"underline"}},children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Content"}),(0,r.jsx)("th",{children:"Meta Data"})]})}),(0,r.jsx)("tbody",{children:S.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:e.doc_name}),(0,r.jsx)("td",{children:(0,r.jsx)(g.Z,{content:e.content,trigger:"hover",children:e.content.length>10?"".concat(e.content.slice(0,10),"..."):e.content})}),(0,r.jsx)("td",{children:(0,r.jsx)(g.Z,{content:JSON.stringify(e.meta_info||"{}",null,2),trigger:"hover",children:e.meta_info.length>10?"".concat(e.meta_info.slice(0,10),"..."):e.meta_info})})]},e.id))})]})}):(0,r.jsx)(r.Fragment,{})}),(0,r.jsx)(o.Z,{direction:"row",justifyContent:"flex-end",sx:{marginTop:"20px"},children:(0,r.jsx)(f.Z,{defaultPageSize:20,showSizeChanger:!1,current:P,total:p,onChange:async e=>{let t=await (0,j.PR)("/knowledge/".concat(n,"/chunk/list"),{document_id:m,page:e,page_size:20});t.success&&(Z(t.data.data),x(t.data.total),b(t.data.page))},hideOnSinglePage:!0})})]})}},78915:function(e,t,n){"use strict";n.d(t,{Tk:function(){return d},Kw:function(){return h},PR:function(){return u},Ej:function(){return g}});var r=n(21628),a=n(24214),i=n(52040);let c=a.Z.create({baseURL:i.env.API_BASE_URL});c.defaults.timeout=1e4,c.interceptors.response.use(e=>e.data,e=>Promise.reject(e));var s=n(84835);let o={"content-type":"application/json"},l=e=>{if(!(0,s.isPlainObject)(e))return JSON.stringify(e);let t={...e};for(let e in t){let n=t[e];"string"==typeof n&&(t[e]=n.trim())}return JSON.stringify(t)},d=(e,t)=>{if(t){let n=Object.keys(t).filter(e=>void 0!==t[e]&&""!==t[e]).map(e=>"".concat(e,"=").concat(t[e])).join("&");n&&(e+="?".concat(n))}return c.get("/api"+e,{headers:o}).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)})},h=(e,t)=>{let n=l(t);return c.post("/api"+e,{body:n,headers:o}).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)})},u=(e,t)=>(l(t),c.post(e,t,{headers:o}).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)})),g=(e,t)=>c.post(e,t).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)})}},function(e){e.O(0,[180,877,759,192,409,767,207,253,769,744],function(){return e(e.s=40687)}),_N_E=e.O()}]);

View File

@ -1 +0,0 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4538],{30976:function(e,t,n){Promise.resolve().then(n.bind(n,26257))},26257:function(e,t,n){"use strict";n.r(t);var r=n(9268),a=n(56008),i=n(86006),c=n(78635),s=n(80937),o=n(44334),l=n(311),d=n(22046),h=n(83192),u=n(23910),g=n(71357),f=n(78915);t.default=()=>{let e=(0,a.useRouter)(),{mode:t}=(0,c.tv)(),n=(0,a.useSearchParams)().get("spacename"),j=(0,a.useSearchParams)().get("documentid"),[m,p]=(0,i.useState)(0),[x,P]=(0,i.useState)(0),[S,b]=(0,i.useState)([]);return(0,i.useEffect)(()=>{(async function(){let e=await (0,f.PR)("/knowledge/".concat(n,"/chunk/list"),{document_id:j,page:1,page_size:20});e.success&&(b(e.data.data),p(e.data.total),P(e.data.page))})()},[]),(0,r.jsxs)("div",{className:"p-4",children:[(0,r.jsx)(s.Z,{direction:"row",justifyContent:"flex-start",alignItems:"center",sx:{marginBottom:"20px"},children:(0,r.jsxs)(o.Z,{"aria-label":"breadcrumbs",children:[(0,r.jsx)(l.Z,{onClick:()=>{e.push("/datastores")},underline:"hover",color:"neutral",fontSize:"inherit",children:"Knowledge Space"},"Knowledge Space"),(0,r.jsx)(l.Z,{onClick:()=>{e.push("/datastores/documents?name=".concat(n))},underline:"hover",color:"neutral",fontSize:"inherit",children:"Documents"},"Knowledge Space"),(0,r.jsx)(d.ZP,{fontSize:"inherit",children:"Chunks"})]})}),(0,r.jsx)("div",{className:"p-4",children:S.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(h.Z,{color:"primary",variant:"plain",size:"lg",sx:{"& tbody tr: hover":{backgroundColor:"light"===t?"rgb(246, 246, 246)":"rgb(33, 33, 40)"},"& tbody tr: hover a":{textDecoration:"underline"}},children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Content"}),(0,r.jsx)("th",{children:"Meta Data"})]})}),(0,r.jsx)("tbody",{children:S.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:e.doc_name}),(0,r.jsx)("td",{children:(0,r.jsx)(u.Z,{content:e.content,trigger:"hover",children:e.content.length>10?"".concat(e.content.slice(0,10),"..."):e.content})}),(0,r.jsx)("td",{children:(0,r.jsx)(u.Z,{content:JSON.stringify(e.meta_info||"{}",null,2),trigger:"hover",children:e.meta_info.length>10?"".concat(e.meta_info.slice(0,10),"..."):e.meta_info})})]},e.id))})]}),(0,r.jsx)(s.Z,{direction:"row",justifyContent:"flex-end",sx:{marginTop:"20px"},children:(0,r.jsx)(g.Z,{defaultPageSize:20,showSizeChanger:!1,current:x,total:m,onChange:async e=>{let t=await (0,f.PR)("/knowledge/".concat(n,"/chunk/list"),{document_id:j,page:e,page_size:20});t.success&&(b(t.data.data),p(t.data.total),P(t.data.page))},hideOnSinglePage:!0})})]}):(0,r.jsx)(r.Fragment,{})})]})}},78915:function(e,t,n){"use strict";n.d(t,{Tk:function(){return l},Kw:function(){return d},PR:function(){return h},Ej:function(){return u}});var r=n(21628),a=n(24214);let i=a.Z.create({baseURL:"http://127.0.0.1:5000"});i.defaults.timeout=1e4,i.interceptors.response.use(e=>e.data,e=>Promise.reject(e));var c=n(84835);let s={"content-type":"application/json"},o=e=>{if(!(0,c.isPlainObject)(e))return JSON.stringify(e);let t={...e};for(let e in t){let n=t[e];"string"==typeof n&&(t[e]=n.trim())}return JSON.stringify(t)},l=(e,t)=>{if(t){let n=Object.keys(t).filter(e=>void 0!==t[e]&&""!==t[e]).map(e=>"".concat(e,"=").concat(t[e])).join("&");n&&(e+="?".concat(n))}return i.get("/api"+e,{headers:s}).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)})},d=(e,t)=>{let n=o(t);return i.post("/api"+e,{body:n,headers:s}).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)})},h=(e,t)=>i.post(e,t,{headers:s}).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)}),u=(e,t)=>i.post(e,t).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)})}},function(e){e.O(0,[2180,3933,8942,7192,7518,4289,8635,6412,9253,5769,1744],function(){return e(e.s=30976)}),_N_E=e.O()}]);

View File

@ -0,0 +1 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4538],{30976:function(e,t,n){Promise.resolve().then(n.bind(n,26257))},26257:function(e,t,n){"use strict";n.r(t);var r=n(9268),a=n(56008),i=n(86006),c=n(78635),s=n(90545),o=n(80937),l=n(44334),d=n(311),h=n(22046),u=n(83192),g=n(23910),f=n(71357),j=n(78915);t.default=()=>{let e=(0,a.useRouter)(),{mode:t}=(0,c.tv)(),n=(0,a.useSearchParams)().get("spacename"),m=(0,a.useSearchParams)().get("documentid"),[p,x]=(0,i.useState)(0),[P,b]=(0,i.useState)(0),[S,Z]=(0,i.useState)([]);return(0,i.useEffect)(()=>{(async function(){let e=await (0,j.PR)("/knowledge/".concat(n,"/chunk/list"),{document_id:m,page:1,page_size:20});e.success&&(Z(e.data.data),x(e.data.total),b(e.data.page))})()},[]),(0,r.jsxs)(s.Z,{className:"p-4",sx:{"&":{height:"90%"}},children:[(0,r.jsx)(o.Z,{direction:"row",justifyContent:"flex-start",alignItems:"center",sx:{marginBottom:"20px"},children:(0,r.jsxs)(l.Z,{"aria-label":"breadcrumbs",children:[(0,r.jsx)(d.Z,{onClick:()=>{e.push("/datastores")},underline:"hover",color:"neutral",fontSize:"inherit",children:"Knowledge Space"},"Knowledge Space"),(0,r.jsx)(d.Z,{onClick:()=>{e.push("/datastores/documents?name=".concat(n))},underline:"hover",color:"neutral",fontSize:"inherit",children:"Documents"},"Knowledge Space"),(0,r.jsx)(h.ZP,{fontSize:"inherit",children:"Chunks"})]})}),(0,r.jsx)(s.Z,{className:"p-4",sx:{"&":{height:"90%",overflow:"auto"},"&::-webkit-scrollbar":{display:"none"}},children:S.length?(0,r.jsx)(r.Fragment,{children:(0,r.jsxs)(u.Z,{color:"primary",variant:"plain",size:"lg",sx:{"& tbody tr: hover":{backgroundColor:"light"===t?"rgb(246, 246, 246)":"rgb(33, 33, 40)"},"& tbody tr: hover a":{textDecoration:"underline"}},children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Content"}),(0,r.jsx)("th",{children:"Meta Data"})]})}),(0,r.jsx)("tbody",{children:S.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:e.doc_name}),(0,r.jsx)("td",{children:(0,r.jsx)(g.Z,{content:e.content,trigger:"hover",children:e.content.length>10?"".concat(e.content.slice(0,10),"..."):e.content})}),(0,r.jsx)("td",{children:(0,r.jsx)(g.Z,{content:JSON.stringify(e.meta_info||"{}",null,2),trigger:"hover",children:e.meta_info.length>10?"".concat(e.meta_info.slice(0,10),"..."):e.meta_info})})]},e.id))})]})}):(0,r.jsx)(r.Fragment,{})}),(0,r.jsx)(o.Z,{direction:"row",justifyContent:"flex-end",sx:{marginTop:"20px"},children:(0,r.jsx)(f.Z,{defaultPageSize:20,showSizeChanger:!1,current:P,total:p,onChange:async e=>{let t=await (0,j.PR)("/knowledge/".concat(n,"/chunk/list"),{document_id:m,page:e,page_size:20});t.success&&(Z(t.data.data),x(t.data.total),b(t.data.page))},hideOnSinglePage:!0})})]})}},78915:function(e,t,n){"use strict";n.d(t,{Tk:function(){return d},Kw:function(){return h},PR:function(){return u},Ej:function(){return g}});var r=n(21628),a=n(24214),i=n(52040);let c=a.Z.create({baseURL:i.env.API_BASE_URL});c.defaults.timeout=1e4,c.interceptors.response.use(e=>e.data,e=>Promise.reject(e));var s=n(84835);let o={"content-type":"application/json"},l=e=>{if(!(0,s.isPlainObject)(e))return JSON.stringify(e);let t={...e};for(let e in t){let n=t[e];"string"==typeof n&&(t[e]=n.trim())}return JSON.stringify(t)},d=(e,t)=>{if(t){let n=Object.keys(t).filter(e=>void 0!==t[e]&&""!==t[e]).map(e=>"".concat(e,"=").concat(t[e])).join("&");n&&(e+="?".concat(n))}return c.get("/api"+e,{headers:o}).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)})},h=(e,t)=>{let n=l(t);return c.post("/api"+e,{body:n,headers:o}).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)})},u=(e,t)=>c.post(e,t,{headers:o}).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)}),g=(e,t)=>c.post(e,t).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)})}},function(e){e.O(0,[2180,877,8942,7192,7518,4289,8635,6412,9253,5769,1744],function(){return e(e.s=30976)}),_N_E=e.O()}]);

View File

@ -1 +0,0 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4538],{30976:function(e,t,n){Promise.resolve().then(n.bind(n,26257))},26257:function(e,t,n){"use strict";n.r(t);var r=n(9268),a=n(56008),i=n(86006),c=n(78635),s=n(80937),o=n(44334),l=n(311),d=n(22046),h=n(83192),u=n(23910),g=n(71357),f=n(78915);t.default=()=>{let e=(0,a.useRouter)(),{mode:t}=(0,c.tv)(),n=(0,a.useSearchParams)().get("spacename"),j=(0,a.useSearchParams)().get("documentid"),[m,p]=(0,i.useState)(0),[x,P]=(0,i.useState)(0),[S,_]=(0,i.useState)([]);return(0,i.useEffect)(()=>{(async function(){let e=await (0,f.PR)("/knowledge/".concat(n,"/chunk/list"),{document_id:j,page:1,page_size:20});e.success&&(_(e.data.data),p(e.data.total),P(e.data.page))})()},[]),(0,r.jsxs)("div",{className:"p-4",children:[(0,r.jsx)(s.Z,{direction:"row",justifyContent:"flex-start",alignItems:"center",sx:{marginBottom:"20px"},children:(0,r.jsxs)(o.Z,{"aria-label":"breadcrumbs",children:[(0,r.jsx)(l.Z,{onClick:()=>{e.push("/datastores")},underline:"hover",color:"neutral",fontSize:"inherit",children:"Knowledge Space"},"Knowledge Space"),(0,r.jsx)(l.Z,{onClick:()=>{e.push("/datastores/documents?name=".concat(n))},underline:"hover",color:"neutral",fontSize:"inherit",children:"Documents"},"Knowledge Space"),(0,r.jsx)(d.ZP,{fontSize:"inherit",children:"Chunks"})]})}),(0,r.jsx)("div",{className:"p-4",children:S.length?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(h.Z,{color:"primary",variant:"plain",size:"lg",sx:{"& tbody tr: hover":{backgroundColor:"light"===t?"rgb(246, 246, 246)":"rgb(33, 33, 40)"},"& tbody tr: hover a":{textDecoration:"underline"}},children:[(0,r.jsx)("thead",{children:(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:"Name"}),(0,r.jsx)("th",{children:"Content"}),(0,r.jsx)("th",{children:"Meta Data"})]})}),(0,r.jsx)("tbody",{children:S.map(e=>(0,r.jsxs)("tr",{children:[(0,r.jsx)("td",{children:e.doc_name}),(0,r.jsx)("td",{children:(0,r.jsx)(u.Z,{content:e.content,trigger:"hover",children:e.content.length>10?"".concat(e.content.slice(0,10),"..."):e.content})}),(0,r.jsx)("td",{children:(0,r.jsx)(u.Z,{content:JSON.stringify(e.meta_info||"{}",null,2),trigger:"hover",children:e.meta_info.length>10?"".concat(e.meta_info.slice(0,10),"..."):e.meta_info})})]},e.id))})]}),(0,r.jsx)(s.Z,{direction:"row",justifyContent:"flex-end",sx:{marginTop:"20px"},children:(0,r.jsx)(g.Z,{defaultPageSize:20,showSizeChanger:!1,current:x,total:m,onChange:async e=>{let t=await (0,f.PR)("/knowledge/".concat(n,"/chunk/list"),{document_id:j,page:e,page_size:20});t.success&&(_(t.data.data),p(t.data.total),P(t.data.page))},hideOnSinglePage:!0})})]}):(0,r.jsx)(r.Fragment,{})})]})}},78915:function(e,t,n){"use strict";n.d(t,{Tk:function(){return d},Kw:function(){return h},PR:function(){return u},Ej:function(){return g}});var r=n(21628),a=n(24214),i=n(52040);let c=a.Z.create({baseURL:i.env.API_BASE_URL});c.defaults.timeout=1e4,c.interceptors.response.use(e=>e.data,e=>Promise.reject(e));var s=n(84835);let o={"content-type":"application/json"},l=e=>{if(!(0,s.isPlainObject)(e))return JSON.stringify(e);let t={...e};for(let e in t){let n=t[e];"string"==typeof n&&(t[e]=n.trim())}return JSON.stringify(t)},d=(e,t)=>{if(t){let n=Object.keys(t).filter(e=>void 0!==t[e]&&""!==t[e]).map(e=>"".concat(e,"=").concat(t[e])).join("&");n&&(e+="?".concat(n))}return c.get("/api"+e,{headers:o}).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)})},h=(e,t)=>{let n=l(t);return c.post("/api"+e,{body:n,headers:o}).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)})},u=(e,t)=>c.post(e,t,{headers:o}).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)}),g=(e,t)=>c.post(e,t).then(e=>e).catch(e=>{r.ZP.error(e),Promise.reject(e)})}},function(e){e.O(0,[2180,780,8942,7192,7518,4289,8635,6412,9253,5769,1744],function(){return e(e.s=30976)}),_N_E=e.O()}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +0,0 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{20736:function(e,t,a){Promise.resolve().then(a.bind(a,93768))},93768:function(e,t,a){"use strict";a.r(t);var o=a(9268),n=a(89081),r=a(86006),i=a(50318),l=a(90545),s=a(77614),c=a(53113),d=a(35086),u=a(53047),h=a(54842),v=a(67830),m=a(19700),p=a(92391),g=a(78915),x=a(56008),f=a(76394),j=a.n(f);t.default=function(){var e;let t=p.z.object({query:p.z.string().min(1)}),a=(0,x.useRouter)(),[f,y]=(0,r.useState)(!1),b=(0,m.cI)({resolver:(0,v.F)(t),defaultValues:{}}),{data:w}=(0,n.Z)(async()=>await (0,g.Kw)("/v1/chat/dialogue/scenes")),_=async e=>{let{query:t}=e;try{var o,n;y(!0),b.reset();let e=await (0,g.Kw)("/v1/chat/dialogue/new",{chat_mode:"chat_normal"});(null==e?void 0:e.success)&&(null==e?void 0:null===(o=e.data)||void 0===o?void 0:o.conv_uid)&&a.push("/chat?id=".concat(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.conv_uid,"&initMessage=").concat(t))}catch(e){}finally{y(!1)}};return(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)("div",{className:"mx-auto h-full justify-center flex max-w-3xl flex-col gap-8 px-5 pt-6",children:[(0,o.jsx)("div",{className:"my-0 mx-auto",children:(0,o.jsx)(j(),{src:"/LOGO.png",alt:"Revolutionizing Database Interactions with Private LLM Technology",width:856,height:160,className:"w-full",unoptimized:!0})}),(0,o.jsx)("div",{className:"grid gap-8 lg:grid-cols-3",children:(0,o.jsxs)("div",{className:"lg:col-span-3",children:[(0,o.jsx)(i.Z,{className:"text-[#878c93]",children:"Quick Start"}),(0,o.jsx)(l.Z,{className:"grid pt-7 rounded-xl gap-2 lg:grid-cols-3 lg:gap-6",sx:{["& .".concat(s.Z.root)]:{color:"var(--joy-palette-primary-solidColor)",backgroundColor:"var(--joy-palette-primary-solidBg)",height:"52px","&: hover":{backgroundColor:"var(--joy-palette-primary-solidHoverBg)"}},["& .".concat(s.Z.disabled)]:{cursor:"not-allowed",pointerEvents:"unset",color:"var(--joy-palette-primary-plainColor)",backgroundColor:"var(--joy-palette-primary-softDisabledBg)","&: hover":{backgroundColor:"var(--joy-palette-primary-softDisabledBg)"}}},children:null==w?void 0:null===(e=w.data)||void 0===e?void 0:e.map(e=>(0,o.jsx)(c.Z,{disabled:null==e?void 0:e.show_disable,size:"md",variant:"solid",className:"text-base rounded-none",onClick:async()=>{var t,o;let n=await (0,g.Kw)("/v1/chat/dialogue/new",{chat_mode:e.chat_scene});(null==n?void 0:n.success)&&(null==n?void 0:null===(t=n.data)||void 0===t?void 0:t.conv_uid)&&a.push("/chat?id=".concat(null==n?void 0:null===(o=n.data)||void 0===o?void 0:o.conv_uid,"&scene=").concat(e.chat_scene))},children:e.scene_name},e.chat_scene))})]})}),(0,o.jsx)("div",{className:"mt-6 mb-[10%] pointer-events-none inset-x-0 bottom-0 z-0 mx-auto flex w-full max-w-3xl flex-col items-center justify-center max-md:border-t xl:max-w-4xl [&>*]:pointer-events-auto",children:(0,o.jsx)("form",{style:{maxWidth:"100%",width:"100%",position:"relative",display:"flex",marginTop:"auto",overflow:"visible",background:"none",justifyContent:"center",marginLeft:"auto",marginRight:"auto",height:"52px"},onSubmit:e=>{b.handleSubmit(_)(e)},children:(0,o.jsx)(d.ZP,{sx:{width:"100%"},variant:"outlined",placeholder:"Ask anything",endDecorator:(0,o.jsx)(u.ZP,{type:"submit",disabled:f,children:(0,o.jsx)(h.Z,{})}),...b.register("query")})})})]})})}},78915:function(e,t,a){"use strict";a.d(t,{Tk:function(){return d},Kw:function(){return u},PR:function(){return h},Ej:function(){return v}});var o=a(21628),n=a(24214),r=a(52040);let i=n.Z.create({baseURL:r.env.API_BASE_URL});i.defaults.timeout=1e4,i.interceptors.response.use(e=>e.data,e=>Promise.reject(e));var l=a(84835);let s={"content-type":"application/json"},c=e=>{if(!(0,l.isPlainObject)(e))return JSON.stringify(e);let t={...e};for(let e in t){let a=t[e];"string"==typeof a&&(t[e]=a.trim())}return JSON.stringify(t)},d=(e,t)=>{if(t){let a=Object.keys(t).filter(e=>void 0!==t[e]&&""!==t[e]).map(e=>"".concat(e,"=").concat(t[e])).join("&");a&&(e+="?".concat(a))}return i.get("/api"+e,{headers:s}).then(e=>e).catch(e=>{o.ZP.error(e),Promise.reject(e)})},u=(e,t)=>{let a=c(t);return i.post("/api"+e,{body:a,headers:s}).then(e=>e).catch(e=>{o.ZP.error(e),Promise.reject(e)})},h=(e,t)=>i.post(e,t,{headers:s}).then(e=>e).catch(e=>{o.ZP.error(e),Promise.reject(e)}),v=(e,t)=>i.post(e,t).then(e=>e).catch(e=>{o.ZP.error(e),Promise.reject(e)})}},function(e){e.O(0,[2180,780,272,5086,6316,1259,3191,9253,5769,1744],function(){return e(e.s=20736)}),_N_E=e.O()}]);

View File

@ -1 +0,0 @@
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1931],{20736:function(e,t,a){Promise.resolve().then(a.bind(a,93768))},93768:function(e,t,a){"use strict";a.r(t);var o=a(9268),n=a(89081),r=a(86006),i=a(50318),l=a(90545),s=a(77614),c=a(53113),d=a(35086),u=a(53047),h=a(54842),v=a(67830),m=a(19700),p=a(92391),g=a(78915),x=a(56008),f=a(76394),j=a.n(f);t.default=function(){var e;let t=p.z.object({query:p.z.string().min(1)}),a=(0,x.useRouter)(),[f,y]=(0,r.useState)(!1),b=(0,m.cI)({resolver:(0,v.F)(t),defaultValues:{}}),{data:w}=(0,n.Z)(async()=>await (0,g.Kw)("/v1/chat/dialogue/scenes")),_=async e=>{let{query:t}=e;try{var o,n;y(!0),b.reset();let e=await (0,g.Kw)("/v1/chat/dialogue/new",{chat_mode:"chat_normal"});(null==e?void 0:e.success)&&(null==e?void 0:null===(o=e.data)||void 0===o?void 0:o.conv_uid)&&a.push("/chat?id=".concat(null==e?void 0:null===(n=e.data)||void 0===n?void 0:n.conv_uid,"&initMessage=").concat(t))}catch(e){}finally{y(!1)}};return(0,o.jsx)(o.Fragment,{children:(0,o.jsxs)("div",{className:"mx-auto h-full justify-center flex max-w-3xl flex-col gap-8 px-5 pt-6",children:[(0,o.jsx)("div",{className:"my-0 mx-auto",children:(0,o.jsx)(j(),{src:"/LOGO.png",alt:"Revolutionizing Database Interactions with Private LLM Technology",width:856,height:160,className:"w-full",unoptimized:!0})}),(0,o.jsx)("div",{className:"grid gap-8 lg:grid-cols-3",children:(0,o.jsxs)("div",{className:"lg:col-span-3",children:[(0,o.jsx)(i.Z,{className:"text-[#878c93]",children:"Quick Start"}),(0,o.jsx)(l.Z,{className:"grid pt-7 rounded-xl gap-2 lg:grid-cols-3 lg:gap-6",sx:{["& .".concat(s.Z.root)]:{color:"var(--joy-palette-primary-solidColor)",backgroundColor:"var(--joy-palette-primary-solidBg)",height:"52px","&: hover":{backgroundColor:"var(--joy-palette-primary-solidHoverBg)"}},["& .".concat(s.Z.disabled)]:{cursor:"not-allowed",pointerEvents:"unset",color:"var(--joy-palette-primary-plainColor)",backgroundColor:"var(--joy-palette-primary-softDisabledBg)","&: hover":{backgroundColor:"var(--joy-palette-primary-softDisabledBg)"}}},children:null==w?void 0:null===(e=w.data)||void 0===e?void 0:e.map(e=>(0,o.jsx)(c.Z,{disabled:null==e?void 0:e.show_disable,size:"md",variant:"solid",className:"text-base rounded-none",onClick:async()=>{var t,o;let n=await (0,g.Kw)("/v1/chat/dialogue/new",{chat_mode:e.chat_scene});(null==n?void 0:n.success)&&(null==n?void 0:null===(t=n.data)||void 0===t?void 0:t.conv_uid)&&a.push("/chat?id=".concat(null==n?void 0:null===(o=n.data)||void 0===o?void 0:o.conv_uid,"&scene=").concat(e.chat_scene))},children:e.scene_name},e.chat_scene))})]})}),(0,o.jsx)("div",{className:"mt-6 mb-[10%] pointer-events-none inset-x-0 bottom-0 z-0 mx-auto flex w-full max-w-3xl flex-col items-center justify-center max-md:border-t xl:max-w-4xl [&>*]:pointer-events-auto",children:(0,o.jsx)("form",{style:{maxWidth:"100%",width:"100%",position:"relative",display:"flex",marginTop:"auto",overflow:"visible",background:"none",justifyContent:"center",marginLeft:"auto",marginRight:"auto",height:"52px"},onSubmit:e=>{b.handleSubmit(_)(e)},children:(0,o.jsx)(d.ZP,{sx:{width:"100%"},variant:"outlined",placeholder:"Ask anything",endDecorator:(0,o.jsx)(u.ZP,{type:"submit",disabled:f,children:(0,o.jsx)(h.Z,{})}),...b.register("query")})})})]})})}},78915:function(e,t,a){"use strict";a.d(t,{Tk:function(){return c},Kw:function(){return d},PR:function(){return u},Ej:function(){return h}});var o=a(21628),n=a(24214);let r=n.Z.create({baseURL:"http://127.0.0.1:5000"});r.defaults.timeout=1e4,r.interceptors.response.use(e=>e.data,e=>Promise.reject(e));var i=a(84835);let l={"content-type":"application/json"},s=e=>{if(!(0,i.isPlainObject)(e))return JSON.stringify(e);let t={...e};for(let e in t){let a=t[e];"string"==typeof a&&(t[e]=a.trim())}return JSON.stringify(t)},c=(e,t)=>{if(t){let a=Object.keys(t).filter(e=>void 0!==t[e]&&""!==t[e]).map(e=>"".concat(e,"=").concat(t[e])).join("&");a&&(e+="?".concat(a))}return r.get("/api"+e,{headers:l}).then(e=>e).catch(e=>{o.ZP.error(e),Promise.reject(e)})},d=(e,t)=>{let a=s(t);return r.post("/api"+e,{body:a,headers:l}).then(e=>e).catch(e=>{o.ZP.error(e),Promise.reject(e)})},u=(e,t)=>r.post(e,t,{headers:l}).then(e=>e).catch(e=>{o.ZP.error(e),Promise.reject(e)}),h=(e,t)=>r.post(e,t).then(e=>e).catch(e=>{o.ZP.error(e),Promise.reject(e)})}},function(e){e.O(0,[2180,3933,272,5086,6316,1259,3191,9253,5769,1744],function(){return e(e.s=20736)}),_N_E=e.O()}]);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Some files were not shown because too many files have changed in this diff Show More