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]:
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
def conversation_id(self) -> Optional[str]:
curr = self.current_project
+14 -5
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)
async def process_agent_turn_by_chat_id(app: Application, chat_id: int, prompt: str):
"""Triggers an agent turn from external event (like Web Uploader)."""
async def process_agent_turn_by_chat_id(
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)
session = session_manager.get_or_create(chat_id)
is_fa = (session.language or "").lower() in ("fa", "farsi", "persian", "🇮🇷 persian / farsi (فارسی)")
@@ -2727,12 +2732,15 @@ async def process_agent_turn_by_chat_id(app: Application, chat_id: int, prompt:
return
# Create dummy update/context wrapper or send initial status message
if initial_status_text:
initial_status = initial_status_text
else:
initial_status = (
f"📁 <b>پروژه:</b> <code>{escape_html(curr_proj.name)}</code>\n\n"
f"💭 <i>در حال پردازش فایل‌های آپلود شده روی پروژه <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>Processing uploaded files for <b>{escape_html(curr_proj.name)}</b>...</i>"
f"💭 <i>Thinking on project <b>{escape_html(curr_proj.name)}</b>...</i>"
)
status_msg = await app.bot.send_message(
chat_id=chat_id,
@@ -2751,6 +2759,7 @@ async def process_agent_turn_by_chat_id(app: Application, chat_id: int, prompt:
class DummyContext:
def __init__(self, application):
self.application = application
self.bot = application.bot
dummy_update = DummyUpdate(chat_id, status_msg)
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)
for k, p in accessible.items():
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()
break
File diff suppressed because one or more lines are too long