Skip to content

Conversation

@mudler
Copy link
Owner

@mudler mudler commented Jan 12, 2026

collection names can't contain upper characters or spaces (breaks pgsql indexes)

Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
Copilot AI review requested due to automatic review settings January 12, 2026 22:15
@mudler mudler merged commit cfdefcd into main Jan 12, 2026
2 of 4 checks passed
@mudler mudler deleted the chore/collection-lowercase branch January 12, 2026 22:15
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to sanitize collection names in the knowledge base by removing spaces and converting to lowercase to ensure consistent naming conventions.

Changes:

  • Modified NewWrappedClient function to sanitize collection names by trimming spaces and converting to lowercase
  • Added import for strings package

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


func NewWrappedClient(baseURL, apiKey, collection string) *WrappedClient {
func NewWrappedClient(baseURL, apiKey, c string) *WrappedClient {
collection := strings.TrimSpace(strings.ToLower(c))
Copy link

Copilot AI Jan 12, 2026

Choose a reason for hiding this comment

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

The implementation only removes leading and trailing spaces using TrimSpace, but according to the PR title "no spaces", all spaces (including internal ones) should be removed. For example, a collection name "My Collection Name" would become "my collection name" instead of "mycollectionname". Consider using strings.ReplaceAll to remove all spaces from the collection name.

Suggested change
collection := strings.TrimSpace(strings.ToLower(c))
collection := strings.ReplaceAll(strings.ToLower(strings.TrimSpace(c)), " ", "")

Copilot uses AI. Check for mistakes.
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.

2 participants