Skip to content

Fix cloud embedding endpoint validation - #588

Merged
AAswordman merged 1 commit into
AAswordman:mainfrom
hd18512614931-cyber:fix-cloud-embedding-endpoint-validation
Jun 4, 2026
Merged

Fix cloud embedding endpoint validation#588
AAswordman merged 1 commit into
AAswordman:mainfrom
hd18512614931-cyber:fix-cloud-embedding-endpoint-validation

Conversation

@hd18512614931-cyber

Copy link
Copy Markdown
Contributor

Summary

  • validate the cloud embedding endpoint before saving memory search settings
  • show inline endpoint errors for blank, non-http(s), whitespace, and multi-URL values
  • show a saved toast after settings are successfully saved

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 --check
  • Attempted bash ./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.

Copilot AI review requested due to automatic review settings June 4, 2026 14:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
@hd18512614931-cyber

Copy link
Copy Markdown
Contributor Author

<img width="873" height="1920" alt="Image_1780584055392_816" src="https://github.com/user-attachments/assets/412
Image_1780584041202_144
e2364-f649-4d3f-afe9-9141565525e2" />

@AAswordman

Copy link
Copy Markdown
Owner

我想的是,要不试试换行和空格就直接不允许输入了,或者输入的时候直接过滤
如果是报错的话有一种亡羊补牢的感觉

@AAswordman
AAswordman merged commit d0c83cb into AAswordman:main Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants