Fix cloud embedding endpoint validation - #588
Merged
AAswordman merged 1 commit intoJun 4, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds client-side validation and user feedback for the cloud embedding endpoint in the Memory Search settings dialog.
Changes:
- Added localized validation error strings for cloud embedding endpoint (CN/EN).
- Added inline validation UI (error state + supporting text) for the endpoint field.
- Added endpoint validation on save and a “settings saved” toast on successful save.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| app/src/main/res/values/strings.xml | Adds Chinese endpoint validation error messages. |
| app/src/main/res/values-en/strings.xml | Adds English endpoint validation error messages. |
| app/src/main/java/com/ai/assistance/operit/ui/features/memory/screens/dialogs/MemorySearchSettingsDialog.kt | Implements endpoint validation, displays field errors, and shows a save confirmation toast. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+485
to
+488
| val trimmed = endpoint.trim() | ||
| if (trimmed.isBlank()) return blankError | ||
| if (!trimmed.startsWith("http://") && !trimmed.startsWith("https://")) return schemeError | ||
| if (trimmed.any { it.isWhitespace() }) return whitespaceError |
Comment on lines
+488
to
+491
| if (trimmed.any { it.isWhitespace() }) return whitespaceError | ||
|
|
||
| val urlMatches = Regex("https?://").findAll(trimmed).count() | ||
| if (urlMatches > 1) return multipleUrlsError |
Comment on lines
+318
to
+325
| val endpointValidationError = validateCloudEmbeddingEndpoint( | ||
| endpoint = endpoint, | ||
| blankError = endpointBlankError, | ||
| schemeError = endpointSchemeError, | ||
| whitespaceError = endpointWhitespaceError, | ||
| multipleUrlsError = endpointMultipleUrlsError | ||
| ) | ||
| if (cloudEnabled && endpointValidationError != null) { |
Contributor
Author
|
<img width="873" height="1920" alt="Image_1780584055392_816" src="https://github.com/user-attachments/assets/412 |
Owner
|
我想的是,要不试试换行和空格就直接不允许输入了,或者输入的时候直接过滤 |
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.

Summary
Context
A cloud embedding endpoint can currently persist a stale multi-line value, for example a SiliconFlow endpoint followed by an old OpenRouter URL. That makes rebuild requests hit an invalid/combined endpoint and surface as 404 or invalid-host errors. The settings dialog also closes without visible confirmation, so it is hard to tell whether the save succeeded.
Testing
git diff --checkbash ./gradlew :app:compileDebugKotlin --no-daemon, but the local checkout cannot resolve project:terminal(No matching variant of project :terminal was found), before Kotlin compilation starts.