Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions astrbot/core/astr_main_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,17 +783,23 @@ async def _handle_webchat(
if not user_prompt or not chatui_session_id or not session or session.display_name:
return

llm_resp = await prov.text_chat(
system_prompt=(
"You are a conversation title generator. "
"Generate a concise title in the same language as the user’s input, "
"no more than 10 words, capturing only the core topic."
"If the input is a greeting, small talk, or has no clear topic, "
"(e.g., “hi”, “hello”, “haha”), return <None>. "
"Output only the title itself or <None>, with no explanations."
),
prompt=f"Generate a concise title for the following user query:\n{user_prompt}",
)
try:
llm_resp = await prov.text_chat(
system_prompt=(
"You are a conversation title generator. "
"Generate a concise title in the same language as the user’s input, "
"no more than 10 words, capturing only the core topic."
"If the input is a greeting, small talk, or has no clear topic, "
"(e.g., “hi”, “hello”, “haha”), return <None>. "
"Output only the title itself or <None>, with no explanations."
),
prompt=f"Generate a concise title for the following user query:\n{user_prompt}",
)
Comment thread
whatevertogo marked this conversation as resolved.
except Exception:
logger.exception(
"Failed to generate webchat title for session %s", chatui_session_id
)
Comment thread
whatevertogo marked this conversation as resolved.
return
if llm_resp and llm_resp.completion_text:
title = llm_resp.completion_text.strip()
if not title or "<None>" in title:
Expand Down Expand Up @@ -836,7 +842,7 @@ def _apply_sandbox_tools(
req.func_tool.add_tool(PYTHON_TOOL)
req.func_tool.add_tool(FILE_UPLOAD_TOOL)
req.func_tool.add_tool(FILE_DOWNLOAD_TOOL)
req.system_prompt += f"\n{SANDBOX_MODE_PROMPT}\n"
req.system_prompt = f"{req.system_prompt or ''}\n{SANDBOX_MODE_PROMPT}\n"
Comment thread
whatevertogo marked this conversation as resolved.
Outdated


def _proactive_cron_job_tools(req: ProviderRequest) -> None:
Expand Down
2 changes: 1 addition & 1 deletion astrbot/core/core_lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
from astrbot.core.platform.manager import PlatformManager
from astrbot.core.platform_message_history_mgr import PlatformMessageHistoryManager
from astrbot.core.provider.manager import ProviderManager
from astrbot.core.star import PluginManager
from astrbot.core.star.context import Context
from astrbot.core.star.star_handler import EventType, star_handlers_registry, star_map
from astrbot.core.star.star_manager import PluginManager
from astrbot.core.subagent_orchestrator import SubAgentOrchestrator
from astrbot.core.umop_config_router import UmopConfigRouter
from astrbot.core.updator import AstrBotUpdator
Expand Down
20 changes: 17 additions & 3 deletions astrbot/core/event_bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,25 @@ async def dispatch(self) -> None:
while True:
event: AstrMessageEvent = await self.event_queue.get()
conf_info = self.astrbot_config_mgr.get_conf_info(event.unified_msg_origin)
self._print_event(event, conf_info["name"])
scheduler = self.pipeline_scheduler_mapping.get(conf_info["id"])
if not isinstance(conf_info, dict):
logger.error(
f"Invalid conf_info for origin {event.unified_msg_origin}: {conf_info}"
)
continue

conf_id = conf_info.get("id")
if not conf_id:
logger.error(
f"Incomplete conf_info for origin {event.unified_msg_origin}: {conf_info}"
)
continue
Comment thread
whatevertogo marked this conversation as resolved.
Outdated

conf_name = conf_info.get("name") or str(conf_id)
self._print_event(event, conf_name)
scheduler = self.pipeline_scheduler_mapping.get(conf_id)
if not scheduler:
logger.error(
f"PipelineScheduler not found for id: {conf_info['id']}, event ignored."
f"PipelineScheduler not found for id: {conf_id}, event ignored."
)
continue
asyncio.create_task(scheduler.execute(event))
Expand Down
Loading
Loading