AI Update: تست پرامپت خودکار برام هیچ نتیجه ای نفرستاد

This commit is contained in:
Antigravity Bot
2026-08-30 12:32:35 +03:30
parent ce1d64b28f
commit 9ac541d4fc
3 changed files with 36 additions and 18 deletions
+9
View File
@@ -134,6 +134,15 @@ class Session:
def current_project(self) -> Optional[Project]: def current_project(self) -> Optional[Project]:
return session_manager.get_current_project(self.chat_id) return session_manager.get_current_project(self.chat_id)
@current_project.setter
def current_project(self, val: Any):
if isinstance(val, Project):
self.active_project = val.name
elif isinstance(val, str):
self.active_project = val
elif val is None:
self.active_project = None
@property @property
def conversation_id(self) -> Optional[str]: def conversation_id(self) -> Optional[str]:
curr = self.current_project curr = self.current_project
+19 -10
View File
@@ -2717,8 +2717,13 @@ async def upload_command(update: Update, context: ContextTypes.DEFAULT_TYPE):
] ]
await update.message.reply_html(msg, reply_markup=InlineKeyboardMarkup(keyboard), disable_web_page_preview=True) await update.message.reply_html(msg, reply_markup=InlineKeyboardMarkup(keyboard), disable_web_page_preview=True)
async def process_agent_turn_by_chat_id(app: Application, chat_id: int, prompt: str): async def process_agent_turn_by_chat_id(
"""Triggers an agent turn from external event (like Web Uploader).""" app: Application,
chat_id: int,
prompt: str,
initial_status_text: Optional[str] = None,
):
"""Triggers an agent turn from external event (like Web Uploader or AI Button)."""
curr_proj = session_manager.get_current_project(chat_id) curr_proj = session_manager.get_current_project(chat_id)
session = session_manager.get_or_create(chat_id) session = session_manager.get_or_create(chat_id)
is_fa = (session.language or "").lower() in ("fa", "farsi", "persian", "🇮🇷 persian / farsi (فارسی)") is_fa = (session.language or "").lower() in ("fa", "farsi", "persian", "🇮🇷 persian / farsi (فارسی)")
@@ -2727,13 +2732,16 @@ async def process_agent_turn_by_chat_id(app: Application, chat_id: int, prompt:
return return
# Create dummy update/context wrapper or send initial status message # Create dummy update/context wrapper or send initial status message
initial_status = ( if initial_status_text:
f"📁 <b>پروژه:</b> <code>{escape_html(curr_proj.name)}</code>\n\n" initial_status = initial_status_text
f"💭 <i>در حال پردازش فایل‌های آپلود شده روی پروژه <b>{escape_html(curr_proj.name)}</b>...</i>" else:
if is_fa else initial_status = (
f"📁 <b>Project:</b> <code>{escape_html(curr_proj.name)}</code>\n\n" f"📁 <b>پروژه:</b> <code>{escape_html(curr_proj.name)}</code>\n\n"
f"💭 <i>Processing uploaded files for <b>{escape_html(curr_proj.name)}</b>...</i>" f"💭 <i>در حال تفکر روی پروژه <b>{escape_html(curr_proj.name)}</b>...</i>"
) if is_fa else
f"📁 <b>Project:</b> <code>{escape_html(curr_proj.name)}</code>\n\n"
f"💭 <i>Thinking on project <b>{escape_html(curr_proj.name)}</b>...</i>"
)
status_msg = await app.bot.send_message( status_msg = await app.bot.send_message(
chat_id=chat_id, chat_id=chat_id,
text=initial_status, text=initial_status,
@@ -2751,6 +2759,7 @@ async def process_agent_turn_by_chat_id(app: Application, chat_id: int, prompt:
class DummyContext: class DummyContext:
def __init__(self, application): def __init__(self, application):
self.application = application self.application = application
self.bot = application.bot
dummy_update = DummyUpdate(chat_id, status_msg) dummy_update = DummyUpdate(chat_id, status_msg)
dummy_context = DummyContext(app) dummy_context = DummyContext(app)
@@ -4576,7 +4585,7 @@ async def callback_handler(update: Update, context: ContextTypes.DEFAULT_TYPE):
accessible = session_manager.get_all_accessible_projects(chat_id) accessible = session_manager.get_all_accessible_projects(chat_id)
for k, p in accessible.items(): for k, p in accessible.items():
if k.lower() == btn_project.lower() or p.name.lower() == btn_project.lower(): if k.lower() == btn_project.lower() or p.name.lower() == btn_project.lower():
session.current_project = p.name session.active_project = p.name
session_manager.save() session_manager.save()
break break
File diff suppressed because one or more lines are too long