-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: vision now uses content.data #89
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThis pull request updates how image and file data are extracted from incoming content. In the Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant IOHandler as "user_chat IO Handler"
Client->>IOHandler: Send payload with content object
IOHandler->>IOHandler: Access data via payload.data
IOHandler->>IOHandler: Extract images & files using regex
IOHandler->>Client: Return output (user ID, thread ID, content ID, platform ID, images & files)
sequenceDiagram
participant Sender
participant Processor as "MessageAndVisionProcessor"
Sender->>Processor: Provide content wrapped in data object
Processor->>Processor: Access content via content.data.content
Processor->>Processor: Retrieve images and files from content.data.images/files
Processor->>Sender: Return processed output
Possibly related PRs
Poem
Tip 🌐 Web search-backed reviews and chat
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
examples/example-vision.ts
(1 hunks)packages/core/src/core/processors/message-and-vision-processor.ts
(1 hunks)
🔇 Additional comments (4)
examples/example-vision.ts (1)
96-101
: LGTM!The file extraction logic correctly uses the new data structure while maintaining the existing functionality.
packages/core/src/core/processors/message-and-vision-processor.ts (3)
61-62
: LGTM!The content extraction correctly handles both string content and the new data structure.
64-68
: LGTM!The image extraction correctly uses the new data structure while maintaining proper type handling.
69-76
: LGTM!The file extraction correctly uses the new data structure while maintaining proper type handling for file data and MIME types.
examples/example-vision.ts
Outdated
const images = Array.from(payload.content.data.matchAll(imageRegex)) | ||
.map((match) => (match as string[])[1]) | ||
.filter((url) => url.length > 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix inconsistent data access.
The code accesses payload.content.data
for regex matching but uses payload.content
directly in the output object. This inconsistency could lead to issues.
Apply this diff to maintain consistency:
- const images = Array.from(payload.content.data.matchAll(imageRegex))
+ const content = payload.content.data;
+ const images = Array.from(content.matchAll(imageRegex))
.map((match) => (match as string[])[1])
.filter((url) => url.length > 0);
const output = {
- content: payload.content,
+ content,
userId: payload.userId,
images: images.length > 0 ? images : undefined,
files: files.length > 0 ? files : undefined,
};
Also applies to: 104-104
Summary by CodeRabbit