Skip to content

Commit

Permalink
Test setup 5
Browse files Browse the repository at this point in the history
  • Loading branch information
tssweeney committed Oct 29, 2024
1 parent 1a4ca68 commit b207ac7
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions weave/trace_server/clickhouse_trace_server_batched.py
Original file line number Diff line number Diff line change
Expand Up @@ -1068,7 +1068,7 @@ def get_object_refs_root_val(
objs = self._select_objs_query(
project_id=project_id_scope,
conditions=conditions,
object_id_conditions=object_id_conds,
object_id_conditions=object_id_conditions,
parameters=parameters,
)
for obj in objs:
Expand Down Expand Up @@ -1404,13 +1404,13 @@ def feedback_create(self, req: tsi.FeedbackCreateReq) -> tsi.FeedbackCreateRes:
validate_feedback_create_req(req)

feedback_type = req.feedback_type
res_payload = req.payload
req_payload = req.payload

for feedback_base_model in feedback_base_models:
if base_model_name(feedback_base_model) == feedback_type:
res_payload = base_model_dump(
feedback_base_model.model_validate(res_payload)
)
req_payload = feedback_base_model.model_validate(
req_payload
).model_dump()
break

# Augment emoji with alias.
Expand All @@ -1424,12 +1424,12 @@ def feedback_create(self, req: tsi.FeedbackCreateReq) -> tsi.FeedbackCreateRes:
detoned = detone_emojis(em)
req.payload["detoned"] = detoned
req.payload["detoned_alias"] = emoji.demojize(detoned)
res_payload = req.payload
req_payload = req.payload

feedback_id = generate_id()
created_at = datetime.datetime.now(ZoneInfo("UTC"))
# TODO: Any validation on weave_ref?
payload = _dict_value_to_dump(req.payload)
payload = _dict_value_to_dump(req_payload)
MAX_PAYLOAD = 1024
if len(payload) > MAX_PAYLOAD:
raise InvalidRequest("Feedback payload too large")
Expand All @@ -1440,7 +1440,7 @@ def feedback_create(self, req: tsi.FeedbackCreateReq) -> tsi.FeedbackCreateRes:
"wb_user_id": req.wb_user_id,
"creator": req.creator,
"feedback_type": req.feedback_type,
"payload": req.payload,
"payload": req_payload,
"created_at": created_at,
}
prepared = TABLE_FEEDBACK.insert(row).prepare(database_type="clickhouse")
Expand All @@ -1449,7 +1449,7 @@ def feedback_create(self, req: tsi.FeedbackCreateReq) -> tsi.FeedbackCreateRes:
id=feedback_id,
created_at=created_at,
wb_user_id=req.wb_user_id,
payload=res_payload,
payload=req_payload,
)

def feedback_query(self, req: tsi.FeedbackQueryReq) -> tsi.FeedbackQueryRes:
Expand Down

0 comments on commit b207ac7

Please sign in to comment.