Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: sql command #560

Merged
merged 1 commit into from
Nov 24, 2024
Merged

fix: sql command #560

merged 1 commit into from
Nov 24, 2024

Conversation

0xFlicker
Copy link
Contributor

Relates to:

Risks

Low

Background

got this error on startup after updating main:

Error handling message: SqliteError: near "type": syntax error
    at Database.prepare (/eliza/node_modules/better-sqlite3/lib/methods/wrappers.js:5:21)
    at SqliteDatabaseAdapter.searchMemoriesByEmbedding (/eliza/packages/adapter-sqlite/dist/index.js:332:30)
    at SqliteDatabaseAdapter.createMemory (/eliza/packages/adapter-sqlite/dist/index.js:250:42)
    at MemoryManager.createMemory (/eliza/packages/core/dist/index.js:2322:40)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async MessageManager.handleMessage (/eliza/packages/client-discord/dist/index.js:1953:9) {
  code: 'SQLITE_ERROR'
}

What does this PR do?

Fixes SQL for searching memories from:

SELECT *, vec_distance_L2(embedding, ?) AS similarity
      FROM memories
      WHERE embedding IS NOT NULL type = ? AND agentId = ? AND roomId = ? ORDER BY similarity DESC LIMIT ?

to

SELECT *, vec_distance_L2(embedding, ?) AS similarity
      FROM memories
      WHERE embedding IS NOT NULL AND type = ? AND agentId = ? AND roomId = ? ORDER BY similarity DESC LIMIT ?

notice the missing AND which matches the error

What kind of change is this?

Bug fixes (non-breaking change which fixes an issue)

Documentation changes needed?

Testing

Where should a reviewer start?

Detailed testing steps

Discord username

0xlfick

@sirkitree
Copy link
Collaborator

Thanks! I was totally struggling with this yesterday and thought it was my new client I'm workign on. Tested this and it works beautifully. talk about needle in a haystack.

@sirkitree sirkitree merged commit 704c7d5 into elizaOS:main Nov 24, 2024
2 checks passed
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