Skip to content

Conversation

@awilfox
Copy link
Member

@awilfox awilfox commented Dec 17, 2025

No description provided.

Copy link
Member Author

@awilfox awilfox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall info about how this was developed.

willa/web/app.py Outdated
Comment on lines 40 to 55
async def get_step(self, step_id: str) -> Optional[StepDict]:
# Get step and related feedback
query = """
SELECT s.*,
f.id feedback_id,
f.value feedback_value,
f."comment" feedback_comment
FROM "Step" s left join "Feedback" f on s.id = f."stepId"
WHERE s.id = $1
"""
result = await self.execute_query(query, {"step_id": step_id})
if not result:
return None
return self._convert_step_row_to_dict(result[0])


Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a monkey patch for Chainlit/chainlit#2729.

Comment on lines +79 to +86
get_langfuse_client().create_score(
name='feedback',
value=float(feedback.value),
session_id=step['threadId'] if not trace_id else None,
trace_id=trace_id,
data_type='BOOLEAN',
comment=feedback.comment
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Based on 29816ad

Comment on lines 109 to 113
dl = ChainlitDataLayer(database_url=database_url)
dl.get_step = get_step.__get__(dl)
return dl
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Horrible monkeypatch until Chainlit/chainlit#2729 is merged.


if 'ai_message' in reply:
await cl.Message(content=reply['ai_message']).send()
cl.context.current_run.metadata['langfuse_trace_id'] = reply['langfuse_trace_id']
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Save the trace ID into the run metadata, which is where Chainlit stores Feedback objects (forId -> the run, not the message).

Copy link
Member

@anarchivist anarchivist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks great - thanks for submitting the upstream patch, too.

Co-authored-by: Dave Zuckerman <dzuckerm@berkeley.edu>
@awilfox awilfox force-pushed the awilfox/AP-531-feedback branch from 0f290a5 to 9394a6f Compare December 18, 2025 23:43
@awilfox
Copy link
Member Author

awilfox commented Dec 18, 2025

v2:

  • Match SQL style to ours, not upstream's. Resolves @anarchivist's comment.
  • Ignore linter errors for things that aren't permanent
    (it turns out linters have good taste and don't like horrible metaprogramming either)
  • Add Co-author tag for @davezuckerman since it was his Langfuse call I integrated.
  • Remove "[ugly wip]" tag from commit message. It is still both of those things, but it should probably be merged so we can close out this feature. I was hoping Chainlit upstream would review my MR quickly, but they're probably already on a well-deserved holiday.

@awilfox awilfox marked this pull request as ready for review December 18, 2025 23:45
@awilfox awilfox merged commit 9394a6f into main Dec 19, 2025
9 checks passed
@awilfox awilfox deleted the awilfox/AP-531-feedback branch December 19, 2025 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants