Skip to content

refactor(llm): extract LLMService into quickquip/llm/service.py#2

Merged
3aKHP merged 2 commits intomainfrom
refactor/architecture-cleanup
Apr 4, 2026
Merged

refactor(llm): extract LLMService into quickquip/llm/service.py#2
3aKHP merged 2 commits intomainfrom
refactor/architecture-cleanup

Conversation

@3aKHP
Copy link
Copy Markdown
Owner

@3aKHP 3aKHP commented Apr 4, 2026

Summary

  • Move LLMService from plugins/llm_runtime.py to quickquip/llm/service.py,使业务逻辑完全位于框架无关层
  • plugins/llm_runtime.py 瘦身为 thin re-export shim,保持向后兼容
  • quickquip/app/message_pipeline.py import 路径指向新位置
  • tieba_random_post 限流 从 (2, 1) 调整为 (6, 3)

附带修复

  • delete_message_from_context: 增加 recent_message_bufferNone 守卫,修复 buffer 未绑定时的 AttributeError
  • 移除死代码 _format_quoted_speaker(仅 prompting.py 内部使用,类上无调用方)
  • TYPE_CHECKING 守卫用于 GroupStatsTrackerGroupRuleSwitchRecentMessageBuffer,避免运行时循环依赖
  • SWITCHABLE_RULES 改为方法内延迟 import

Test plan

  • python test_tz.py 全部通过
  • from plugins.llm_runtime import LLMService, llm_service, ResolvedGroupSettings 正常
  • from quickquip.llm.service import LLMService, llm_service 正常
  • from quickquip.app.message_pipeline import llm_service 正常

3aKHP added 2 commits April 5, 2026 01:44
Move LLMService from plugins/llm_runtime.py to quickquip/llm/service.py
so that the business logic lives inside the framework-agnostic layer.
plugins/llm_runtime.py becomes a thin re-export shim.

Also: use TYPE_CHECKING guards for framework-layer imports, add None
guard on delete_message_from_context, remove dead _format_quoted_speaker,
and bump tieba_random_post rate limit to (6, 3).
test_llm.py patched attributes on the plugins.llm_runtime module, but
after the extraction the real code lives in quickquip.llm.service.
Redirect the import so monkey-patches take effect.
@3aKHP 3aKHP merged commit 671e345 into main Apr 4, 2026
2 checks passed
@3aKHP 3aKHP deleted the refactor/architecture-cleanup branch April 4, 2026 17:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant