refactor(context): 简化跨上下文功能,移除通用共享组模式
移除了基于白名单/黑名单的通用上下文共享组(ContextGroup)功能。此模式实现复杂且与S4U模式功能重叠,移除后可大幅简化配置项和内部逻辑。 主要变更: - 从配置中删除了 `ContextGroup` 模型和 `cross_context.groups` 列表。 - 删除了 `build_cross_context_normal` 和 `get_context_group` 函数。 - 保留并增强了S4U(Search for User)模式,为其增加了更详细的日志和健壮性检查。 - `get_intercom_group_context` 函数被调整为专门服务于 `maizone_context_group`。 BREAKING CHANGE: 移除了 `cross_context.groups` 配置项及相关的通用上下文共享组功能。请迁移至S4U模式以实现跨上下文需求。
This commit is contained in:
@@ -19,7 +19,7 @@ import json5
|
||||
import orjson
|
||||
|
||||
from src.common.logger import get_logger
|
||||
from src.plugin_system.apis import config_api, cross_context_api, person_api
|
||||
from src.plugin_system.apis import config_api, person_api
|
||||
|
||||
from .content_service import ContentService
|
||||
from .cookie_service import CookieService
|
||||
@@ -63,10 +63,7 @@ class QZoneService:
|
||||
|
||||
async def send_feed(self, topic: str, stream_id: str | None) -> dict[str, Any]:
|
||||
"""发送一条说说"""
|
||||
# --- 获取互通组上下文 ---
|
||||
context = await self._get_intercom_context(stream_id) if stream_id else None
|
||||
|
||||
story = await self.content_service.generate_story(topic, context=context)
|
||||
story = await self.content_service.generate_story(topic, context=None)
|
||||
if not story:
|
||||
return {"success": False, "message": "生成说说内容失败"}
|
||||
|
||||
@@ -302,12 +299,6 @@ class QZoneService:
|
||||
|
||||
# --- Internal Helper Methods ---
|
||||
|
||||
async def _get_intercom_context(self, stream_id: str) -> str | None:
|
||||
"""
|
||||
获取互通组的聊天上下文。
|
||||
"""
|
||||
# 实际的逻辑已迁移到 cross_context_api
|
||||
return await cross_context_api.get_intercom_group_context("maizone_context_group")
|
||||
|
||||
async def _reply_to_own_feed_comments(self, feed: dict, api_client: dict):
|
||||
"""处理对自己说说的评论并进行回复"""
|
||||
|
||||
Reference in New Issue
Block a user