Skip to content

Commit 5db2b07

Browse files
committed
WIP: unexpected error
1 parent 1a03743 commit 5db2b07

File tree

6 files changed

+317
-261
lines changed

6 files changed

+317
-261
lines changed

common/common/models.py

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from typing import Any, Literal
22
from uuid import UUID
3-
from pydantic import BaseModel, Field, JsonValue, field_validator
3+
from pydantic import BaseModel, Field, JsonValue, field_validator, model_validator
44
from enum import Enum
55
import json
66

@@ -153,3 +153,30 @@ class FunctionCallSSEData(BaseModel):
153153
class FunctionCallSSE(BaseSSE):
154154
event: Literal["copilotFunctionCall"] = "copilotFunctionCall"
155155
data: FunctionCallSSEData
156+
157+
158+
159+
class StatusUpdateSSEData(BaseModel):
160+
eventType: Literal["INFO", "WARNING", "ERROR"]
161+
message: str
162+
group: Literal["reasoning"] = "reasoning"
163+
details: list[dict[str, str | int | float | None]] | None = None
164+
#artifacts: list[ClientArtifact] | None = None
165+
166+
@model_validator(mode="before")
167+
@classmethod
168+
def exclude_fields(cls, values):
169+
# Exclude these fields from being in the "details" field. (since this
170+
# pollutes the JSON output)
171+
_exclude_fields = []
172+
173+
if details := values.get("details"):
174+
for detail in details:
175+
for key in list(detail.keys()):
176+
if key.lower() in _exclude_fields:
177+
detail.pop(key, None)
178+
return values
179+
180+
class StatusUpdateSSE(BaseSSE):
181+
event: Literal["copilotStatusUpdate"] = "copilotStatusUpdate"
182+
data: StatusUpdateSSEData

0 commit comments

Comments
 (0)