mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-06 07:56:52 +08:00
refactor: 移除异步pop操作
This commit is contained in:
@@ -124,9 +124,7 @@ class MoviePilotAgent:
|
|||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
# 系统提示词
|
# 系统提示词
|
||||||
system_prompt = prompt_manager.get_agent_prompt(
|
system_prompt = prompt_manager.get_agent_prompt(channel=self.channel)
|
||||||
channel=self.channel
|
|
||||||
)
|
|
||||||
|
|
||||||
# LLM 模型(用于 agent 执行)
|
# LLM 模型(用于 agent 执行)
|
||||||
llm = self._initialize_llm()
|
llm = self._initialize_llm()
|
||||||
@@ -311,7 +309,9 @@ class MoviePilotAgent:
|
|||||||
text = self._extract_text_content(msg.content)
|
text = self._extract_text_content(msg.content)
|
||||||
if text:
|
if text:
|
||||||
# 过滤掉包含在 <think> 标签中的内容
|
# 过滤掉包含在 <think> 标签中的内容
|
||||||
text = re.sub(r'<think>.*?(?:</think>|$)', '', text, flags=re.DOTALL)
|
text = re.sub(
|
||||||
|
r"<think>.*?(?:</think>|$)", "", text, flags=re.DOTALL
|
||||||
|
)
|
||||||
final_text = text.strip()
|
final_text = text.strip()
|
||||||
break
|
break
|
||||||
|
|
||||||
@@ -549,7 +549,7 @@ class AgentManager:
|
|||||||
logger.info(f"会话 {session_id} 的worker被取消")
|
logger.info(f"会话 {session_id} 的worker被取消")
|
||||||
finally:
|
finally:
|
||||||
# 清理已完成的worker记录
|
# 清理已完成的worker记录
|
||||||
await self._session_workers.pop(session_id, None)
|
self._session_workers.pop(session_id, None) # noqa
|
||||||
# 如果队列为空,清理队列
|
# 如果队列为空,清理队列
|
||||||
if (
|
if (
|
||||||
session_id in self._session_queues
|
session_id in self._session_queues
|
||||||
|
|||||||
Reference in New Issue
Block a user