zamalali
commited on
Commit
·
cc96dc3
1
Parent(s):
aecc0fd
Updated app description
Browse files
app.py
CHANGED
@@ -160,6 +160,11 @@ with gr.Blocks(
|
|
160 |
Under the hood, it leverages a hybrid ranking approach combining dense retrieval, BM25 scoring, and cross-encoder re-ranking for optimal discovery.<br>
|
161 |
If the agent returns no repositories found, it means no chain was invoked due to GPU unavailability. Please duplicate the space and re-run.
|
162 |
</p>
|
|
|
|
|
|
|
|
|
|
|
163 |
<p>
|
164 |
🚀 Check out the full DeepGit version on
|
165 |
<a href="https://github.com/zamalali/DeepGit" target="_blank">GitHub</a> and ⭐
|
@@ -214,10 +219,14 @@ with gr.Blocks(
|
|
214 |
def chat_with_agent(user_msg, repo, history):
|
215 |
logging.info("[Chat] User sent message: '%s' for repo: '%s'", user_msg, repo)
|
216 |
if not user_msg or not user_msg.strip():
|
217 |
-
|
218 |
-
return
|
219 |
if not repo:
|
220 |
-
|
|
|
|
|
|
|
|
|
221 |
full_query = f"[{repo}] {user_msg}"
|
222 |
try:
|
223 |
result = agent.agent_executor.invoke({"input": full_query})
|
@@ -226,8 +235,9 @@ with gr.Blocks(
|
|
226 |
except Exception as e:
|
227 |
answer = f"Error: {e}"
|
228 |
logging.error("[Chat] Error in agent_executor: %s", e)
|
229 |
-
|
230 |
-
|
|
|
231 |
|
232 |
# Disable send button if no repo is selected or message is blank, and show a helpful message
|
233 |
def can_send(user_msg, repo):
|
|
|
160 |
Under the hood, it leverages a hybrid ranking approach combining dense retrieval, BM25 scoring, and cross-encoder re-ranking for optimal discovery.<br>
|
161 |
If the agent returns no repositories found, it means no chain was invoked due to GPU unavailability. Please duplicate the space and re-run.
|
162 |
</p>
|
163 |
+
<p>
|
164 |
+
<strong>New!</strong> 🗨️ After searching, you can <b>chat with the agent about any repository you find</b>.<br>
|
165 |
+
The conversation agent runs in the background and is ready to answer your questions about setup, usage, or details for each repo.<br>
|
166 |
+
Just click "Go to Chat" after your search, select a repository, and start your conversation!
|
167 |
+
</p>
|
168 |
<p>
|
169 |
🚀 Check out the full DeepGit version on
|
170 |
<a href="https://github.com/zamalali/DeepGit" target="_blank">GitHub</a> and ⭐
|
|
|
219 |
def chat_with_agent(user_msg, repo, history):
|
220 |
logging.info("[Chat] User sent message: '%s' for repo: '%s'", user_msg, repo)
|
221 |
if not user_msg or not user_msg.strip():
|
222 |
+
yield history + [["", "Please enter a message before sending."]], history
|
223 |
+
return
|
224 |
if not repo:
|
225 |
+
yield history + [[user_msg, "Please select a repository first."]], history
|
226 |
+
return
|
227 |
+
# Show user message immediately with a loading placeholder
|
228 |
+
new_history = history + [[user_msg, "⏳ Loading..."]]
|
229 |
+
yield new_history, new_history
|
230 |
full_query = f"[{repo}] {user_msg}"
|
231 |
try:
|
232 |
result = agent.agent_executor.invoke({"input": full_query})
|
|
|
235 |
except Exception as e:
|
236 |
answer = f"Error: {e}"
|
237 |
logging.error("[Chat] Error in agent_executor: %s", e)
|
238 |
+
# Replace the loading message with the actual answer
|
239 |
+
new_history[-1][1] = answer
|
240 |
+
yield new_history, new_history
|
241 |
|
242 |
# Disable send button if no repo is selected or message is blank, and show a helpful message
|
243 |
def can_send(user_msg, repo):
|