-
Couldn't load subscription status.
- Fork 5.5k
Perplexity - chat-completions-advanced #18755
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
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. 2 Skipped Deployments
|
WalkthroughAdds a new Perplexity "Chat Completions (Advanced)" action with multi-message support and Perplexity search controls, updates metadata/version for the existing chat-completions action, and bumps the Perplexity component package version and @pipedream/platform dependency. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant User as User Input
participant Action as Chat Completions (Advanced)
participant App as Perplexity App Client
participant API as Perplexity API
User->>Action: Provide props (model, messages[] or system+role+content, knobs, search controls)
Note over Action: Build messages[] (parse JSON strings or use objects, inject system, fallback to single-turn)
Action->>Action: Assemble data payload (model, messages, temperature/top_p/max_tokens/stream, search filters, top_k, return_images/related_questions)
Action->>App: chatCompletions({ $, data })
App->>API: POST /chat/completions
API-->>App: Response (optionally streamed)
App-->>Action: Final response
Action-->>User: Return response and export $summary (notes streaming if set)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Pre-merge checks and finishing touches❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
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. Comment |
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: 2
🧹 Nitpick comments (3)
components/perplexity/actions/chat-completions-advanced/chat-completions-advanced.mjs (3)
22-27: messages type should be object[] for proper UI/validation (not string[]).Current type is string[] but code also accepts objects. Use object[] with explicit schema for a better UX and safer validation.
Apply:
- messages: { - type: "string[]", - label: "Messages (JSON strings or UI collection)", - description: "Array of message objects: [{ role: 'system'|'user'|'assistant', content: '...' }, ...]. If provided, 'role' and 'content' are ignored.", - optional: true, - }, + messages: { + type: "object[]", + label: "Messages", + description: "Array of message objects. If provided, 'role' and 'content' are ignored.", + optional: true, + properties: { + role: { + type: "string", + label: "Role", + description: "Message role", + options: ["system", "user", "assistant"], + default: "user", + }, + content: { + type: "string", + label: "Content", + }, + }, + },
114-117: Harden parsing of JSON strings.Uncaught JSON.parse errors will be opaque. Add a guard for clearer user feedback.
- messages = this.messages.map((m) => - typeof m === "string" - ? JSON.parse(m) - : m); + messages = this.messages.map((m, idx) => { + if (typeof m !== "string") return m; + try { + return JSON.parse(m); + } catch (err) { + throw new Error(`Invalid JSON at messages[${idx}]: ${err.message}`); + } + });
80-84: Prefer enum options for searchRecencyFilter.Expose allowed values to users to prevent invalid inputs.
- searchRecencyFilter: { - type: "string", - label: "Search Recency Filter", - description: "Prefer recent sources (e.g., 'day', 'week', 'month', 'year')", - optional: true, - }, + searchRecencyFilter: { + type: "string", + label: "Search Recency Filter", + description: "Prefer recent sources", + options: ["day", "week", "month", "year"], + optional: true, + },
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (3)
components/perplexity/actions/chat-completions-advanced/chat-completions-advanced.mjs(1 hunks)components/perplexity/actions/chat-completions/chat-completions.mjs(1 hunks)components/perplexity/package.json(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
components/perplexity/actions/chat-completions-advanced/chat-completions-advanced.mjs (1)
components/perplexity/actions/chat-completions/chat-completions.mjs (1)
response(36-47)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
- GitHub Check: Lint Code Base
- GitHub Check: pnpm publish
- GitHub Check: Publish TypeScript components
- GitHub Check: Ensure component commits modify component versions
- GitHub Check: Verify TypeScript components
🔇 Additional comments (4)
components/perplexity/actions/chat-completions/chat-completions.mjs (1)
6-7: LGTM: metadata update only.URL and version bump look good; no runtime changes.
components/perplexity/actions/chat-completions-advanced/chat-completions-advanced.mjs (2)
6-8: Version mismatch with PR description.File declares version "0.0.1" but PR mentions "1.0.0". Align version or PR text before merge.
66-72: Streaming behavior confirmed. Thestreamflag is passed through to the Perplexity API but, since the Pipedreamaxioswrapper doesn’t implement SSE handling (noresponseType: 'stream'), responses are fully buffered and returned as final text, exactly as described.components/perplexity/package.json (1)
16-16: Verify @pipedream/platform v3.1.0 compatibility across Perplexity. Ensureaxios, prop definitions, annotations, and method signatures inperplexity.app.mjs,chat-completions.mjs, andchat-completions-advanced.mjsbehave as in v1.x.
components/perplexity/actions/chat-completions-advanced/chat-completions-advanced.mjs
Show resolved
Hide resolved
components/perplexity/actions/chat-completions-advanced/chat-completions-advanced.mjs
Show resolved
Hide resolved
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.
Hi @michelle0927, LGTM! Ready for QA!
Resolves #18642
Summary by CodeRabbit