refactor: 优化 packages/astrbot 内置插件的代码结构以提高可维护性和可读性 (#2924)

* 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>
This commit is contained in:
Soulter
2025-10-01 21:29:15 +08:00
committed by GitHub
parent 8a9a044f95
commit afe007ca0b
18 changed files with 1675 additions and 1213 deletions
+1 -1
View File
@@ -6,7 +6,7 @@ class CommandTokens:
self.tokens = []
self.len = 0
def get(self, idx: int):
def get(self, idx: int) -> str | None:
if idx >= self.len:
return None
return self.tokens[idx].strip()