mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-11-10 04:43:33 +00:00
feat(editor): ChatExcel
ChatExcel devlop part 2
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user