AI Update: تغییرات مورد تایید است، لطفا اعمال کن.
This commit is contained in:
+29
-9
@@ -2762,11 +2762,18 @@ async def process_agent_turn_by_chat_id(
|
|||||||
model_to_use = getattr(curr_proj, "model", None) or getattr(session, "model", None) or settings.default_model or "gemini-3.7-flash-auto"
|
model_to_use = getattr(curr_proj, "model", None) or getattr(session, "model", None) or settings.default_model or "gemini-3.7-flash-auto"
|
||||||
effort_to_use = getattr(curr_proj, "reasoning_effort", None) or getattr(session, "reasoning_effort", None)
|
effort_to_use = getattr(curr_proj, "reasoning_effort", None) or getattr(session, "reasoning_effort", None)
|
||||||
model_display = get_model_display_name(model_to_use, effort_to_use)
|
model_display = get_model_display_name(model_to_use, effort_to_use)
|
||||||
|
curr_cid = getattr(curr_proj, "conversation_id", None)
|
||||||
|
conv_title = getattr(curr_proj, "conversation_titles", {}).get(curr_cid) if curr_cid and hasattr(curr_proj, "conversation_titles") else None
|
||||||
|
if is_fa:
|
||||||
|
topic_str = f" • 🏷️ «{escape_html(conv_title)}»" if conv_title else ""
|
||||||
initial_status = (
|
initial_status = (
|
||||||
f"📁 <b>پروژه:</b> <code>{escape_html(curr_proj.name)}</code>\n\n"
|
f"📁 <b>پروژه:</b> <code>{escape_html(curr_proj.name)}</code>{topic_str}\n\n"
|
||||||
f"💭 <b>{escape_html(model_display)}</b>"
|
f"💭 <b>{escape_html(model_display)}</b>"
|
||||||
if is_fa else
|
)
|
||||||
f"📁 <b>Project:</b> <code>{escape_html(curr_proj.name)}</code>\n\n"
|
else:
|
||||||
|
topic_str = f" • 🏷️ \"{escape_html(conv_title)}\"" if conv_title else ""
|
||||||
|
initial_status = (
|
||||||
|
f"📁 <b>Project:</b> <code>{escape_html(curr_proj.name)}</code>{topic_str}\n\n"
|
||||||
f"💭 <b>{escape_html(model_display)}</b>"
|
f"💭 <b>{escape_html(model_display)}</b>"
|
||||||
)
|
)
|
||||||
status_msg = await app.bot.send_message(
|
status_msg = await app.bot.send_message(
|
||||||
@@ -6532,14 +6539,18 @@ async def process_agent_turn(
|
|||||||
if status_msg_to_reuse:
|
if status_msg_to_reuse:
|
||||||
status_msg = status_msg_to_reuse
|
status_msg = status_msg_to_reuse
|
||||||
else:
|
else:
|
||||||
|
curr_cid = getattr(curr_proj, "conversation_id", None)
|
||||||
|
conv_title = getattr(curr_proj, "conversation_titles", {}).get(curr_cid) if curr_cid and hasattr(curr_proj, "conversation_titles") else None
|
||||||
if is_fa:
|
if is_fa:
|
||||||
|
topic_str = f" • 🏷️ «{escape_html(conv_title)}»" if conv_title else ""
|
||||||
initial_status = (
|
initial_status = (
|
||||||
f"📁 <b>پروژه:</b> <code>{escape_html(curr_proj.name)}</code>\n\n"
|
f"📁 <b>پروژه:</b> <code>{escape_html(curr_proj.name)}</code>{topic_str}\n\n"
|
||||||
f"💭 <b>{escape_html(model_display)}</b>"
|
f"💭 <b>{escape_html(model_display)}</b>"
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
topic_str = f" • 🏷️ \"{escape_html(conv_title)}\"" if conv_title else ""
|
||||||
initial_status = (
|
initial_status = (
|
||||||
f"📁 <b>Project:</b> <code>{escape_html(curr_proj.name)}</code>\n\n"
|
f"📁 <b>Project:</b> <code>{escape_html(curr_proj.name)}</code>{topic_str}\n\n"
|
||||||
f"💭 <b>{escape_html(model_display)}</b>"
|
f"💭 <b>{escape_html(model_display)}</b>"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -6583,6 +6594,11 @@ async def process_agent_turn(
|
|||||||
session.last_response = raw_text
|
session.last_response = raw_text
|
||||||
curr_proj.last_response = raw_text
|
curr_proj.last_response = raw_text
|
||||||
|
|
||||||
|
# Get dynamic conversation topic if set or updated
|
||||||
|
curr_cid = getattr(curr_proj, "conversation_id", None)
|
||||||
|
conv_title = getattr(curr_proj, "conversation_titles", {}).get(curr_cid) if curr_cid and hasattr(curr_proj, "conversation_titles") else None
|
||||||
|
topic_badge = f" • 🏷️ {escape_html(conv_title)}" if conv_title else ""
|
||||||
|
|
||||||
# Suffix at the BOTTOM of the message
|
# Suffix at the BOTTOM of the message
|
||||||
bottom_parts = []
|
bottom_parts = []
|
||||||
|
|
||||||
@@ -6595,9 +6611,9 @@ async def process_agent_turn(
|
|||||||
if settings.enable_tool_notifications and tools:
|
if settings.enable_tool_notifications and tools:
|
||||||
bottom_parts.append("\n".join(tools[-2:]).strip())
|
bottom_parts.append("\n".join(tools[-2:]).strip())
|
||||||
|
|
||||||
# 3. Status indicator at the bottom stating which model is being used
|
# 3. Status indicator at the bottom stating which model is being used and active topic
|
||||||
if not final:
|
if not final:
|
||||||
bottom_parts.append(f"💭 <b>{escape_html(model_display)}</b> ▌")
|
bottom_parts.append(f"💭 <b>{escape_html(model_display)}</b>{topic_badge} ▌")
|
||||||
|
|
||||||
if raw_text.strip():
|
if raw_text.strip():
|
||||||
formatted_body = markdown_to_telegram_html(raw_text)
|
formatted_body = markdown_to_telegram_html(raw_text)
|
||||||
@@ -6607,11 +6623,15 @@ async def process_agent_turn(
|
|||||||
full_html = formatted_body + (" ▌" if not final else "")
|
full_html = formatted_body + (" ▌" if not final else "")
|
||||||
else:
|
else:
|
||||||
# Still waiting for response text - show project header and thinking at the bottom
|
# Still waiting for response text - show project header and thinking at the bottom
|
||||||
proj_header = f"📁 <b>پروژه:</b> <code>{escape_html(curr_proj.name)}</code>" if is_fa else f"📁 <b>Project:</b> <code>{escape_html(curr_proj.name)}</code>"
|
proj_header = (
|
||||||
|
f"📁 <b>پروژه:</b> <code>{escape_html(curr_proj.name)}</code>{topic_badge}"
|
||||||
|
if is_fa else
|
||||||
|
f"📁 <b>Project:</b> <code>{escape_html(curr_proj.name)}</code>{topic_badge}"
|
||||||
|
)
|
||||||
if bottom_parts:
|
if bottom_parts:
|
||||||
full_html = proj_header + "\n\n" + "\n\n".join(bottom_parts)
|
full_html = proj_header + "\n\n" + "\n\n".join(bottom_parts)
|
||||||
else:
|
else:
|
||||||
thinking_msg = f"💭 <b>{escape_html(model_display)}</b> ▌"
|
thinking_msg = f"💭 <b>{escape_html(model_display)}</b>{topic_badge} ▌"
|
||||||
full_html = proj_header + "\n\n" + thinking_msg
|
full_html = proj_header + "\n\n" + thinking_msg
|
||||||
|
|
||||||
if len(full_html) > settings.max_message_length:
|
if len(full_html) > settings.max_message_length:
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user