Skip to content

Commit

Permalink
fix(core): add filter to vector store retriever
Browse files Browse the repository at this point in the history
  • Loading branch information
LarchLiu committed Jun 26, 2023
1 parent 9913aea commit 5ba4218
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 7 additions & 3 deletions packages/core/src/storage/supabase/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class SupabaseVectorStorage extends VectorStorage<SupabaseVectorConfig> {

async save(data?: WebInfoData) {
if (!data && !this.data)
throw new Error('ImageStorage error: No Storage Data')
throw new Error('VectorStorage error: No Storage Data')

const storageData = (data || this.data)!
const rawDoc = new Document({ pageContent: storageData.content, metadata: this.config.metaData })
Expand All @@ -126,11 +126,10 @@ export class SupabaseVectorStorage extends VectorStorage<SupabaseVectorConfig> {
})

const docs = await textSplitter.splitDocuments([rawDoc])
const store = new SupabaseVectorStore(this.config.embeddingsInfo.embeddings, {
await SupabaseVectorStore.fromDocuments(docs, this.config.embeddingsInfo.embeddings, {
client: this.client,
tableName: this.config.embeddingsInfo.indexName,
})
await store.addDocuments(docs)
}

async getRetriever() {
Expand All @@ -140,6 +139,11 @@ export class SupabaseVectorStorage extends VectorStorage<SupabaseVectorConfig> {
client: this.client,
tableName: this.config.embeddingsInfo.indexName,
queryName: this.config.embeddingsInfo.queryName,
filter: {
appName: this.config.metaData.appName,
botId: this.config.metaData.botId,
userId: this.config.metaData.userId,
},
})
return vectorStore.asRetriever()
}
Expand Down
4 changes: 2 additions & 2 deletions server/nuxt3/composables/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,15 +486,15 @@ export const serverConfig: BasicConfig<ModelsConfig> = {
output: 'Server',
},
cloudflare: {
displayName: 'Cloudflare Worker',
displayName: 'Cloudflare Pages',
config: {
token: {
label: 'Cloudflare Token',
value: '',
require: true,
},
siteid: {
label: 'Worker Name',
label: 'Project Name',
value: '',
require: true,
},
Expand Down

1 comment on commit 5ba4218

@vercel
Copy link

@vercel vercel bot commented on 5ba4218 Jun 26, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

star-nexus – ./

star-nexus-larchliu.vercel.app
star-nexus-git-main-larchliu.vercel.app
star-nexus.vercel.app

Please sign in to comment.