Automatically detect v1 endpoint on base URL input#1167
Conversation
📝 WalkthroughWalkthroughThis PR adds flexible AI endpoint configuration by introducing a URI normalization method that automatically completes Chat Completions endpoint URLs. The new Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/ask_ai_repository_test.dart (1)
4-36: 💤 Low valueLGTM!
Good test coverage for the three main endpoint scenarios. The tests verify the core functionality of
composeChatCompletionsUri.Consider adding edge case tests for trailing slashes (e.g.,
https://api.openai.com/v1/) and URLs with ports to increase confidence in the implementation.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/ask_ai_repository_test.dart` around lines 4 - 36, Add tests covering edge cases for trailing slashes and URLs with ports to ensure AskAiRepository.composeChatCompletionsUri handles them correctly; specifically, add one test that passes a base URL ending with a trailing slash (e.g., 'https://api.openai.com/v1/') and asserts the result is '.../v1/chat/completions', and another test that passes a URL with an explicit port (e.g., 'https://localhost:8080') and asserts the port is preserved in the composed URI; locate the tests alongside the existing group that references AskAiRepository.composeChatCompletionsUri and follow the same test structure and expectations.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/ask_ai_repository_test.dart`:
- Around line 4-36: Add tests covering edge cases for trailing slashes and URLs
with ports to ensure AskAiRepository.composeChatCompletionsUri handles them
correctly; specifically, add one test that passes a base URL ending with a
trailing slash (e.g., 'https://api.openai.com/v1/') and asserts the result is
'.../v1/chat/completions', and another test that passes a URL with an explicit
port (e.g., 'https://localhost:8080') and asserts the port is preserved in the
composed URI; locate the tests alongside the existing group that references
AskAiRepository.composeChatCompletionsUri and follow the same test structure and
expectations.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 3a687081-22bb-4dab-adc2-eafa42e3b5a8
⛔ Files ignored due to path filters (15)
lib/generated/l10n/l10n.dartis excluded by!**/generated/**lib/generated/l10n/l10n_de.dartis excluded by!**/generated/**lib/generated/l10n/l10n_en.dartis excluded by!**/generated/**lib/generated/l10n/l10n_es.dartis excluded by!**/generated/**lib/generated/l10n/l10n_fr.dartis excluded by!**/generated/**lib/generated/l10n/l10n_id.dartis excluded by!**/generated/**lib/generated/l10n/l10n_it.dartis excluded by!**/generated/**lib/generated/l10n/l10n_ja.dartis excluded by!**/generated/**lib/generated/l10n/l10n_ko.dartis excluded by!**/generated/**lib/generated/l10n/l10n_nl.dartis excluded by!**/generated/**lib/generated/l10n/l10n_pt.dartis excluded by!**/generated/**lib/generated/l10n/l10n_ru.dartis excluded by!**/generated/**lib/generated/l10n/l10n_tr.dartis excluded by!**/generated/**lib/generated/l10n/l10n_uk.dartis excluded by!**/generated/**lib/generated/l10n/l10n_zh.dartis excluded by!**/generated/**
📒 Files selected for processing (7)
lib/data/provider/ai/ask_ai.dartlib/data/store/setting.dartlib/l10n/app_en.arblib/l10n/app_zh.arblib/l10n/app_zh_tw.arblib/view/page/setting/entries/ai.darttest/ask_ai_repository_test.dart
Related to #1165.
Summary by CodeRabbit
Improvements
Configuration