From f7d8f4b36effa6a8a4b4dbd494746ec130506348 Mon Sep 17 00:00:00 2001 From: Quan Date: Sun, 8 Oct 2023 09:47:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- README.md | 4 ++-- setup.py | 2 +- sparkdesk_web/core.py | 4 ++-- sparkdesk_web_cli.py | 4 +++- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.gitignore b/.gitignore index d1e9e47..b241a18 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ .idea sparkdesk_web/log dist -build \ No newline at end of file +build +history \ No newline at end of file diff --git a/README.md b/README.md index 2e4dfac..9063ef7 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,11 @@ > 如果该项目对你有帮助,不要忘记给我点个 star 哦! ## 使用方法 ```shell -pip install sparkdesk-api==1.2.0 +pip install sparkdesk-api==1.3.0 ``` 或者 ```shell -pip install sparkdesk-api==1.2.0 -i https://pypi.org/simple +pip install sparkdesk-api==1.3.0 -i https://pypi.org/simple ``` ### 1. Web模式 diff --git a/setup.py b/setup.py index 9f1fc0f..3fa76e6 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="sparkdesk-api", - version="1.2.0", + version="1.3.0", author="HildaM", author_email="Hilda_quan@163.com", description="sparkdesk-api 讯飞星火大模型api", diff --git a/sparkdesk_web/core.py b/sparkdesk_web/core.py index 512687e..a4d8541 100644 --- a/sparkdesk_web/core.py +++ b/sparkdesk_web/core.py @@ -134,11 +134,11 @@ def __streaming_output(self, question): print("\n") return response_text, True - def chat_stream(self, history: bool = False, history_path: str = './data/'): + def chat_stream(self, history: bool = False, history_path: str = './history/'): history_file_path = '' if history: FileUtils.check_dir_path(history_path) - history_file_path = os.path.join(history_path, f'history_{str(datetime.now())}.json') + history_file_path = os.path.join(history_path, f'history_{str(datetime.now().strftime("%Y-%m-%d-%H-%M-%S"))}.json') try: self.__create_chat(NEW_CHAT) print("Enter exit or stop to end the conversation.\n") diff --git a/sparkdesk_web_cli.py b/sparkdesk_web_cli.py index 06736ca..2a43bef 100644 --- a/sparkdesk_web_cli.py +++ b/sparkdesk_web_cli.py @@ -27,5 +27,7 @@ # continue chat chat = sparkWeb.create_continuous_chat() - print(chat.chat("请介绍一下西安")) + # while True: + # print(chat.chat(input("Ask: "))) + print(chat.chat("肇庆是一个什么样的城市")) print(chat.chat("刚才你说的是哪个城市?")) \ No newline at end of file