Move online ingredient analysis from OpenRouter to DeepSeek - #4
Merged
Merged
Conversation
Point the analysis provider at DeepSeek's official Chat Completions endpoint and the deepseek-flash model, replacing OpenRouter and z-ai/glm-5.3-flash. The /models endpoint on the current key serves only deepseek-flash and deepseek-v4-pro, so flash is the like-for-like tier. Drop the reasoning and provider fields from the request body along with the X-OpenRouter-Title header. Both are OpenRouter-only knobs that DeepSeek silently ignores, and provider.data_collection=deny was being cited in the privacy policy as a limit on upstream retention. Continuing to send a field that does nothing while advertising it to users would have been a guarantee with nothing behind it, so the claim is removed from the UI copy and the README rather than restated. Because the upstream provider changed, bump OnlineAnalysisConsent to version 2. Every existing online consent is void and falls back to local analysis until the user re-confirms against the new data boundary. Move the Keychain slot to v3 for the same reason, so an OpenRouter key cached by an earlier build can never be replayed against DeepSeek. Narrow the transport allowlist to api.deepseek.com/chat/completions and rename OPENROUTER_API_KEY to DEEPSEEK_API_KEY across the xcconfigs, scheme and tests. The local credential still lives only in the gitignored Config/Secrets.xcconfig. Also fix Tests/LabelPipelineHarnessTests, which used XCTUnwrap where it meant XCTSkip and so failed the default suite whenever no photo was supplied. Verified with the full suite (83 tests), the live smoke test against DeepSeek, and a real Pepsi label driven end to end through OCR, the local parser and the live model.
Contributor
|
Capy couldn't review this pull request because not cat's workspace is out of credits, add credits or enable auto-reload to resume automatic reviews. |
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.
Switches the online analysis provider from OpenRouter to DeepSeek's official API, and the model from
z-ai/glm-5.3-flashtodeepseek-flash.The
/modelsendpoint on the current key serves exactly two models —deepseek-flashanddeepseek-v4-pro— so flash is the like-for-like replacement for the tier we were on.Privacy claim removed rather than restated
reasoningandproviderare dropped from the request body, along with theX-OpenRouter-Titleheader. Both are OpenRouter-only knobs that DeepSeek silently ignores.provider.data_collection=denymatters more than the other two: it was being cited in the privacy policy and README as a limit on upstream retention. Sending a field that does nothing while advertising it to users would be a guarantee with nothing behind it, so the claim is deleted from the UI copy and the README instead of reworded.Consent and cached credentials
OnlineAnalysisConsent.currentVersiongoes to 2. The upstream provider changed, so every existing online consent is void and falls back to local analysis until the user re-confirms against the new data boundary — this is the behaviourScanStorealready implements for a version mismatch.The Keychain slot moves to v3 for the same reason, so an OpenRouter key cached by an earlier Debug build can never be replayed against DeepSeek.
Scope
api.deepseek.com+/chat/completions; every other host still fails asinvalidEndpoint.OPENROUTER_API_KEYrenamed toDEEPSEEK_API_KEYacross xcconfigs,project.yml, the scheme and the tests. The local credential still lives only in the gitignoredConfig/Secrets.xcconfigand appears in no tracked file.source_text, one result per id).OpenRouterConfigurationand friends) are deliberately left alone — renaming them is cosmetic churn across ~10 files and belongs in its own PR.Verification
finish_reason=stop.Tests/LabelPipelineHarnessTestsis also fixed here: it usedXCTUnwrapwhere it meantXCTSkip, so it failed the default suite whenever no photo was supplied.Known issue, not fixed here
Driving the real label through the pipeline surfaced a pre-existing parser bug unrelated to this switch:
IngredientTextParser.truncateAtMetadataHeadingdoes not cut compound headings like生产商及委托方:, so a manufacturer's company name is sent to the model even though the privacy copy promises only ingredient names leave the device.生产商is followed by及and委托方is preceded by及, so both of the function's boundary guards reject. Tracked separately.