Skip to content

Commit 9896bba

Browse files
committed
Merge conflicts
2 parents 1d68c65 + bf2bb5f commit 9896bba

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

src/api/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ async def lifespan(app: fastapi.FastAPI):
8484
else:
8585
configure_azure_monitor(connection_string=application_insights_connection_string)
8686

87-
if os.environ.get("AZURE_AI_AGENT_ID") is not None:
87+
if os.environ.get("AZURE_AI_AGENT_ID"):
8888
try:
8989
agent = await ai_client.agents.get_agent(os.environ["AZURE_AI_AGENT_ID"])
9090
logger.info("Agent already exists, skipping creation")

src/api/routes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ async def on_thread_message(self, message: ThreadMessage) -> Optional[str]:
9494
async def on_thread_run(self, run: ThreadRun) -> Optional[str]:
9595
logger.info("MyEventHandler: on_thread_run event received")
9696
run_information = f"ThreadRun status: {run.status}, thread ID: {run.thread_id}"
97-
if run.status == "failed":
98-
run_information += f", error: {run.last_error}"
9997
stream_data = {'content': run_information, 'type': 'thread_run'}
98+
if run.status == "failed":
99+
stream_data['error'] = run.last_error.as_dict()
100100
return serialize_sse_event(stream_data)
101101

102102
async def on_error(self, data: str) -> Optional[str]:

src/api/static/ChatClient.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,19 @@ class ChatClient {
106106

107107
console.log("[ChatClient] Parsed SSE event:", data);
108108

109+
if (data.error) {
110+
if (!messageDiv) {
111+
messageDiv = this.ui.createAssistantMessageDiv();
112+
console.log("[ChatClient] Created new messageDiv for assistant.");
113+
}
114+
this.ui.appendAssistantMessage(
115+
messageDiv,
116+
data.error.message || "An error occurred.",
117+
false
118+
);
119+
return;
120+
}
121+
109122
// Check the data type to decide how to update the UI
110123
if (data.type === "stream_end") {
111124
// End of the stream

src/gunicorn.conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ async def initialize_resources():
216216
credential=creds,
217217
conn_str=os.environ["AZURE_AIPROJECT_CONNECTION_STRING"],
218218
) as ai_client:
219-
220219
# If the environment already has AZURE_AI_AGENT_ID, try
221220
# fetching that agent
222221
if os.environ.get("AZURE_AI_AGENT_ID") is not None:

0 commit comments

Comments
 (0)