mirror of
https://github.com/AstrBotDevs/AstrBot.git
synced 2026-09-21 06:06:10 +08:00
* refactor: code structure for improved readability and maintainability * style: ruff format * Update packages/astrbot/commands/provider.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update packages/astrbot/commands/persona.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update packages/astrbot/commands/llm.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * Update packages/astrbot/commands/conversation.py Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com> * fix: improve error handling message formatting in key switching * fix: update LLM command to use safe get for provider settings * feat: implement ProcessLLMRequest class for handling LLM requests and persona injection --------- Co-authored-by: sourcery-ai[bot] <58596630+sourcery-ai[bot]@users.noreply.github.com>
24 lines
778 B
Python
24 lines
778 B
Python
"""文本转图片命令"""
|
|
|
|
import astrbot.api.star as star
|
|
from astrbot.api.event import AstrMessageEvent, MessageEventResult
|
|
|
|
|
|
class T2ICommand:
|
|
"""文本转图片命令类"""
|
|
|
|
def __init__(self, context: star.Context):
|
|
self.context = context
|
|
|
|
async def t2i(self, event: AstrMessageEvent):
|
|
"""开关文本转图片"""
|
|
config = self.context.get_config(umo=event.unified_msg_origin)
|
|
if config["t2i"]:
|
|
config["t2i"] = False
|
|
config.save_config()
|
|
event.set_result(MessageEventResult().message("已关闭文本转图片模式。"))
|
|
return
|
|
config["t2i"] = True
|
|
config.save_config()
|
|
event.set_result(MessageEventResult().message("已开启文本转图片模式。"))
|