This commit is contained in:
hibobmaster 2023-09-18 13:56:07 +08:00
parent a2027590c8
commit d017323c25
Signed by: bobmaster
SSH key fingerprint: SHA256:5ZYgd8fg+PcNZNy4SzcSKu5JtqZyBF8kUhY7/k2viDk
2 changed files with 4 additions and 12 deletions

View file

@ -4,6 +4,7 @@
- remove pandora
- refactor chat and image genderation backend
- reply in thread by default
- introduce pre-commit hooks
## v1.0.4

View file

@ -121,7 +121,7 @@ class Bot:
# close session
async def close(self, task: asyncio.Task) -> None:
await self.session.aclose()
await self.httpx_client.aclose()
self.driver.disconnect()
task.cancel()
@ -206,6 +206,7 @@ class Bot:
channel_id,
"New conversation created, "
+ "please use !chat to start chatting!",
root_id,
)
except Exception as e:
logger.error(e, exc_info=True)
@ -274,22 +275,12 @@ class Bot:
logger.error(e, exc_info=True)
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
def help(self) -> str:
help_info = (
"!gpt [content], generate response without context conversation\n"
+ "!chat [content], chat with context conversation\n"
+ "!pic [prompt], Image generation by Microsoft Bing\n"
+ "!talk [content], talk using chatgpt web\n"
+ "!goon, continue the incomplete conversation\n"
+ "!pic [prompt], Image generation with DALL·E or LocalAI or stable-diffusion-webui\n" # noqa: E501
+ "!new, start a new conversation\n"
+ "!help, help message"
)