Skip to content

add api usage field in chat_message#8197

Merged
mrfinch merged 2 commits intomasterfrom
saurabh/api-usage
Jan 23, 2026
Merged

add api usage field in chat_message#8197
mrfinch merged 2 commits intomasterfrom
saurabh/api-usage

Conversation

@mrfinch
Copy link
Copy Markdown
Contributor

@mrfinch mrfinch commented Jan 22, 2026

Summary by CodeRabbit

  • New Features
    • Chat messages now include API usage information showing which tool or model was used for each message, helping surface attribution and context in conversations.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Jan 22, 2026

📝 Walkthrough

Walkthrough

This change adds a new public apiUsage object property to ChatMessageSchema, with metadata (title, description), allows additional properties, and defines a nested tool string property to record which tool/model produced the chat message. No other schema fields were modified.

Changes

Cohort / File(s) Summary
Schema Property Addition
app/schemas/models/chat_message.schema.js
Added apiUsage object property to ChatMessageSchema with title/description, additionalProperties: true, and a nested tool string property to track the tool/model used for the message.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Possibly related PRs

Poem

🐰 A tiny field hops into place,
To mark the tool behind each trace,
A whisper of usage, neat and small,
In schema gardens, standing tall,
Hooray for clarity—hop, hop, hooray!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding an apiUsage field to the ChatMessageSchema. It is clear, concise, and directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@app/schemas/models/chat_message.schema.js`:
- Around line 279-290: The apiUsage property currently defined inside the
context object should be relocated to the top-level ChatMessageSchema.properties
to match ai_chat_message.schema.js; remove the apiUsage block from
context.properties and add an identical apiUsage property alongside
actor/parent/text in ChatMessageSchema.properties (preserve type: 'object',
description, additionalProperties: true and its subproperty tool) so the schema
structure is consistent with ai_chat_message.schema.js.

@mrfinch mrfinch merged commit 090a7e8 into master Jan 23, 2026
3 checks passed
@mrfinch mrfinch deleted the saurabh/api-usage branch January 23, 2026 08:20
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.

1 participant