feat: Add Currency Conversion Widget#1027
Open
haosenwang1018 wants to merge 2 commits intoItzCrazyKns:masterfrom
Open
feat: Add Currency Conversion Widget#1027haosenwang1018 wants to merge 2 commits intoItzCrazyKns:masterfrom
haosenwang1018 wants to merge 2 commits intoItzCrazyKns:masterfrom
Conversation
added 2 commits
March 6, 2026 04:07
Add DeepSeek as a new model provider option, including: - DeepSeek LLM implementation with streaming and object generation - DeepSeek Embedding implementation for document/query embeddings - Provider configuration with default models (deepseek-chat, deepseek-reasoner) - Registration in the providers index DeepSeek provides high-quality language models at competitive pricing and uses an OpenAI-compatible API for easy integration.
Add a new currency conversion widget that provides real-time exchange rates: - New currencyWidget.ts with support for 20+ currencies - Uses exchangerate-api.com for free, reliable exchange rate data - Includes currency symbol and name normalization (e.g., dollars -> USD) - Provides related rates for popular currencies as additional context - Integrated with classifier to detect currency conversion queries - Supports natural language queries like 'Convert 100 USD to EUR' This widget follows the existing widget pattern and integrates seamlessly with the search pipeline, showing currency conversions alongside other results.
Contributor
There was a problem hiding this comment.
1 issue found across 9 files
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/lib/models/providers/deepseek/deepseekLLM.ts">
<violation number="1" location="src/lib/models/providers/deepseek/deepseekLLM.ts:106">
P2: Inconsistent JSON parsing between streaming and non-streaming paths - `JSON.parse(tc.function.arguments)` can throw on malformed model output. The streaming path uses tolerant `parse` from `partial-json`, and `generateObject` uses `repairJson`, but `generateText` uses raw `JSON.parse` with no fallback. This creates a reliability regression where non-streaming calls can crash on valid but slightly malformed model responses.</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| return { | ||
| name: tc.function.name, | ||
| id: tc.id, | ||
| arguments: JSON.parse(tc.function.arguments), |
Contributor
There was a problem hiding this comment.
P2: Inconsistent JSON parsing between streaming and non-streaming paths - JSON.parse(tc.function.arguments) can throw on malformed model output. The streaming path uses tolerant parse from partial-json, and generateObject uses repairJson, but generateText uses raw JSON.parse with no fallback. This creates a reliability regression where non-streaming calls can crash on valid but slightly malformed model responses.
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/lib/models/providers/deepseek/deepseekLLM.ts, line 106:
<comment>Inconsistent JSON parsing between streaming and non-streaming paths - `JSON.parse(tc.function.arguments)` can throw on malformed model output. The streaming path uses tolerant `parse` from `partial-json`, and `generateObject` uses `repairJson`, but `generateText` uses raw `JSON.parse` with no fallback. This creates a reliability regression where non-streaming calls can crash on valid but slightly malformed model responses.</comment>
<file context>
@@ -0,0 +1,228 @@
+ return {
+ name: tc.function.name,
+ id: tc.id,
+ arguments: JSON.parse(tc.function.arguments),
+ };
+ }
</file context>
xkonjin
reviewed
Mar 8, 2026
xkonjin
left a comment
There was a problem hiding this comment.
Quick review pass:
- Main risk area here is input validation, path handling, and malformed payload behavior.
- I didn’t see targeted regression coverage in the diff; please add or point CI at a focused test for the changed path in classifier.ts, types.ts, currencyWidget.ts (+6 more).
- Before merge, I’d smoke-test the behavior touched by classifier.ts, types.ts, currencyWidget.ts (+6 more) with malformed input / retry / rollback cases, since that’s where this class of change usually breaks.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds a new currency conversion widget to Perplexica.
Features
Example Queries
Changes
Testing
Fixes #XXX (if there's a related issue)
Summary by cubic
Adds a currency conversion widget that answers FX queries with real-time rates. Also adds DeepSeek as a new model provider for chat and embeddings.
Written for commit 67239a3. Summary will update on new commits.