From d1c1e2ca4351162c621849e27caf9469cb6c8d3e Mon Sep 17 00:00:00 2001 From: TechShrimp <939178127@qq.com> Date: Sun, 15 Oct 2023 15:12:12 +0800 Subject: [PATCH] AutoPEP8 --- config.yaml.template | 13 +++++++------ func_xinghuo_web.py | 7 ++++++- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/config.yaml.template b/config.yaml.template index 93ffcc6..cdd5fb7 100644 --- a/config.yaml.template +++ b/config.yaml.template @@ -58,9 +58,10 @@ tigerbot: key: key model: tigerbot-7b-sft -# 使用讯飞星火模型api需要抓取以下参数 -# 抓取方式详见:https://github.com/HildaM/sparkdesk-api/tree/main/docs -xinghuo_web: - cookie: cookie - fd: fd - GtToken: GtToken +# 使用讯飞星火web模式api需要抓取以下参数 +# 抓取方式详见文档:https://www.bilibili.com/read/cv27066577 +# xinghuo_web: +# cookie: cookie +# fd: fd +# GtToken: GtToken +# prompt: 你是智能聊天机器人,你叫wcferry。请用这个角色回答我的问题 # 根据需要对角色进行设定 \ No newline at end of file diff --git a/func_xinghuo_web.py b/func_xinghuo_web.py index 8709be1..266eadf 100644 --- a/func_xinghuo_web.py +++ b/func_xinghuo_web.py @@ -2,20 +2,25 @@ # -*- coding: utf-8 -*- from sparkdesk_web.core import SparkWeb + class XinghuoWeb(): def __init__(self, xhconf=None) -> None: self._sparkWeb = SparkWeb( cookie=xhconf["cookie"], fd=xhconf["fd"], - GtToken=xhconf["GtToken"] + GtToken=xhconf["GtToken"], ) self._chat = self._sparkWeb.create_continuous_chat() + # 如果有提示词 + if xhconf["prompt"]: + self._chat.chat(xhconf["prompt"]) def get_answer(self, msg: str, sender: str = None) -> str: answer = self._chat.chat(msg) return answer + if __name__ == "__main__": from configuration import Config c = Config()