Update chat interface #70
Reference in New Issue
Block a user
Delete Branch "47-update-chat-interface"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull Request Overview
This PR implements asynchronous streaming support for the chat interface to provide real-time progress updates to users during pipeline execution. The changes enable the application to display step-by-step status messages as the AI agents work through market data retrieval, news gathering, and report generation.
Key changes:
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
gradio_respondto async streaming function and addedfill_height/fill_widthparameters to Gradio interfaceinteract_streamandrun_streammethods to yield intermediate status updates and refactoredrunto consume the streamstream_intermediate_stepsfor Team💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
@@ -86,2 +92,3 @@async for item in self.run_stream(workflow, query, events=events):yield item[nitpick] The comment describes the function as 'ESEGUE (yield)' which is inconsistent with the style used in similar comments. The word 'ESEGUE' (executes) appears to be emphasized but doesn't align well with the yield concept. Consider clarifying that it 'yields' or 'streams' intermediate results and the final response.
@@ -132,2 +140,4 @@# Chiama i listeners (se presenti) per ogni eventofor app_event, listener in events:if app_event.check_event(event.event, step_name):The ellipsis '...' at the end of the string is inconsistent with other yield statements. Line 196 has three dots while lines 181, 183, 185, and 194 use '...' (ellipsis character). Consider using the ellipsis character for consistency.
[nitpick] The default error message 'Errore durante l'esecuzione del workflow.' may not be reached in practice since the stream should always yield at least one item (the error message from line 213). This initialization could be misleading. Consider using a more descriptive default or documenting why this fallback exists.
All chunks (including intermediate status messages) are yielded to Gradio, but only the final response is saved to history. This could be confusing because intermediate status updates like '🔍 Sto controllando la tua richiesta...' will be displayed but not the actual final answer if the stream doesn't clearly differentiate between status updates and the final response. Consider adding logic to distinguish between status messages and the final answer, or document this behavior clearly.
Ho controllato il codice e ho fatto un commit modificando alcune cose della pipeline in modo che vengano usati gli eventi passati in input invece che scriverli dentro staticamente.
Il resto mi sembra giusto tranne per alcune cose:
Se è un comportamento desiderato allora si può risolvere i due commenti e approverò la PR
@@ -0,0 +2,4 @@# Registro centrale popolato da tutti i file Toolkit all'avvio.ACTION_DESCRIPTIONS: dict[str, str] = {}Sarebbe più corretto metterlo dentro il file core.py dato che ci sono tutte le interazioni core con la pipeline.
O ancor meglio che sia un decorator da mettere su ogni funzione di cui si vuole avere una descrizione e che aggiorna il registro, che sia dentro la classe RunMessage o che sia libero
Per mostrare i messagi si può usare la classe RunMessage in modo da uniformare le risposte sia per Telegram che per Gradio
@@ -0,0 +2,4 @@# Registro centrale popolato da tutti i file Toolkit all'avvio.ACTION_DESCRIPTIONS: dict[str, str] = {}Stavo tentando di farne un decorator, ma sfruttando il decorator @tool di agno che però sminchiava il Toolkit. Alla fine ho fatto questo accrocchio che non mi soddisfa in pieno, ma non avevo più tempo e funziona.
Volendo sì, ma mi piaceva l'idea di aggiornare in tempo reale in stile chatGPT/Gemini più che la checklist che fa telegram
Beh infatti se l'idea principale era fare proprio questo va bene, ho messo il commento solo per avere la certezza
@@ -0,0 +2,4 @@# Registro centrale popolato da tutti i file Toolkit all'avvio.ACTION_DESCRIPTIONS: dict[str, str] = {}Non chiudere ancora la pull request che domani provo a fare un decoratore custom così evitiamo quel registro che ho improvvisato
Ho approvato la PR, se ti vanno bene le due cose dei commenti, marcale come risolte e verrà fatta la merge in automatico.
Se vuoi ancora fare delle modifiche, per esempio il decorator, lasciale li finché non hai fatto