Fix
This commit is contained in:
parent
a2027590c8
commit
d017323c25
2 changed files with 4 additions and 12 deletions
|
@ -4,6 +4,7 @@
|
||||||
- remove pandora
|
- remove pandora
|
||||||
- refactor chat and image genderation backend
|
- refactor chat and image genderation backend
|
||||||
- reply in thread by default
|
- reply in thread by default
|
||||||
|
- introduce pre-commit hooks
|
||||||
|
|
||||||
## v1.0.4
|
## v1.0.4
|
||||||
|
|
||||||
|
|
15
src/bot.py
15
src/bot.py
|
@ -121,7 +121,7 @@ class Bot:
|
||||||
|
|
||||||
# close session
|
# close session
|
||||||
async def close(self, task: asyncio.Task) -> None:
|
async def close(self, task: asyncio.Task) -> None:
|
||||||
await self.session.aclose()
|
await self.httpx_client.aclose()
|
||||||
self.driver.disconnect()
|
self.driver.disconnect()
|
||||||
task.cancel()
|
task.cancel()
|
||||||
|
|
||||||
|
@ -206,6 +206,7 @@ class Bot:
|
||||||
channel_id,
|
channel_id,
|
||||||
"New conversation created, "
|
"New conversation created, "
|
||||||
+ "please use !chat to start chatting!",
|
+ "please use !chat to start chatting!",
|
||||||
|
root_id,
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(e, exc_info=True)
|
logger.error(e, exc_info=True)
|
||||||
|
@ -274,22 +275,12 @@ class Bot:
|
||||||
logger.error(e, exc_info=True)
|
logger.error(e, exc_info=True)
|
||||||
raise Exception(e)
|
raise Exception(e)
|
||||||
|
|
||||||
# !gpt command function
|
|
||||||
async def gpt(self, prompt: str) -> str:
|
|
||||||
return await self.askgpt.oneTimeAsk(prompt)
|
|
||||||
|
|
||||||
# !chat command function
|
|
||||||
async def chat(self, prompt: str) -> str:
|
|
||||||
return await self.gptchatbot.ask_async(prompt)
|
|
||||||
|
|
||||||
# !help command function
|
# !help command function
|
||||||
def help(self) -> str:
|
def help(self) -> str:
|
||||||
help_info = (
|
help_info = (
|
||||||
"!gpt [content], generate response without context conversation\n"
|
"!gpt [content], generate response without context conversation\n"
|
||||||
+ "!chat [content], chat with context conversation\n"
|
+ "!chat [content], chat with context conversation\n"
|
||||||
+ "!pic [prompt], Image generation by Microsoft Bing\n"
|
+ "!pic [prompt], Image generation with DALL·E or LocalAI or stable-diffusion-webui\n" # noqa: E501
|
||||||
+ "!talk [content], talk using chatgpt web\n"
|
|
||||||
+ "!goon, continue the incomplete conversation\n"
|
|
||||||
+ "!new, start a new conversation\n"
|
+ "!new, start a new conversation\n"
|
||||||
+ "!help, help message"
|
+ "!help, help message"
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue