AI Update: تست پرامپت خودکار برام هیچ نتیجه ای نفرستاد
This commit is contained in:
+19
-10
@@ -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,13 +2732,16 @@ 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
|
||||
initial_status = (
|
||||
f"📁 <b>پروژه:</b> <code>{escape_html(curr_proj.name)}</code>\n\n"
|
||||
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>"
|
||||
)
|
||||
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>"
|
||||
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(
|
||||
chat_id=chat_id,
|
||||
text=initial_status,
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user