Skip to content

Commit

Permalink
Fix code check
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskerPRC committed Sep 23, 2024
1 parent 367562c commit 258fa21
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion infra_ai_service/common/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async def setup_database(pool):
await conn.execute(
f"""
CREATE INDEX IF NOT EXISTS {settings.TABLE_NAME}_content_idx
ON {settings.TABLE_NAME}
ON {settings.TABLE_NAME}
USING GIN (to_tsvector('{settings.LANGUAGE}', content))
"""
)
3 changes: 2 additions & 1 deletion infra_ai_service/sdk/pgvector.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ async def setup_model_and_pool():
pool = AsyncConnectionPool(conn_str, open=True)

# 设置数据库
await setup_database(pool)
await setup_database(pool)

2 changes: 1 addition & 1 deletion infra_ai_service/service/search_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ async def perform_vector_search(input_data: SearchInput):
await cur.execute(
"""
SELECT id, content, embedding,
1 - (embedding <#> %s::vector)
1 - (embedding <#> %s::vector)
AS similarity
FROM documents
ORDER BY similarity DESC
Expand Down

0 comments on commit 258fa21

Please sign in to comment.