style: ruff format brain.py (argument alignment)
All checks were successful
ci/woodpecker/push/build Pipeline was successful
All checks were successful
ci/woodpecker/push/build Pipeline was successful
This commit is contained in:
34
src/brain.py
34
src/brain.py
@@ -111,7 +111,11 @@ async def update(thought_id: str, req: UpdateRequest) -> Thought | None:
|
||||
RETURNING id::text, content, source, metadata, created_at,
|
||||
embedding IS NOT NULL AS embedded
|
||||
""",
|
||||
new_content, new_source, new_metadata, vec, uid,
|
||||
new_content,
|
||||
new_source,
|
||||
new_metadata,
|
||||
vec,
|
||||
uid,
|
||||
)
|
||||
else:
|
||||
updated = await conn.fetchrow(
|
||||
@@ -122,7 +126,10 @@ async def update(thought_id: str, req: UpdateRequest) -> Thought | None:
|
||||
RETURNING id::text, content, source, metadata, created_at,
|
||||
embedding IS NOT NULL AS embedded
|
||||
""",
|
||||
new_content, new_source, new_metadata, uid,
|
||||
new_content,
|
||||
new_source,
|
||||
new_metadata,
|
||||
uid,
|
||||
)
|
||||
else:
|
||||
updated = await conn.fetchrow(
|
||||
@@ -133,7 +140,9 @@ async def update(thought_id: str, req: UpdateRequest) -> Thought | None:
|
||||
RETURNING id::text, content, source, metadata, created_at,
|
||||
embedding IS NOT NULL AS embedded
|
||||
""",
|
||||
new_source, new_metadata, uid,
|
||||
new_source,
|
||||
new_metadata,
|
||||
uid,
|
||||
)
|
||||
|
||||
return _row_to_thought(updated)
|
||||
@@ -161,7 +170,8 @@ async def delete_by_filter(source: str | None, metadata_id: str | None) -> int:
|
||||
if source and metadata_id:
|
||||
result = await conn.execute(
|
||||
"DELETE FROM thoughts WHERE source = $1 AND metadata->>'id' = $2",
|
||||
source, metadata_id,
|
||||
source,
|
||||
metadata_id,
|
||||
)
|
||||
elif source:
|
||||
result = await conn.execute("DELETE FROM thoughts WHERE source = $1", source)
|
||||
@@ -189,7 +199,10 @@ async def list_thoughts(
|
||||
WHERE source = $1 AND metadata->>'id' = $2
|
||||
ORDER BY created_at DESC LIMIT $3 OFFSET $4
|
||||
""",
|
||||
source, metadata_id, limit, offset,
|
||||
source,
|
||||
metadata_id,
|
||||
limit,
|
||||
offset,
|
||||
)
|
||||
elif source:
|
||||
rows = await conn.fetch(
|
||||
@@ -199,7 +212,9 @@ async def list_thoughts(
|
||||
FROM thoughts WHERE source = $1
|
||||
ORDER BY created_at DESC LIMIT $2 OFFSET $3
|
||||
""",
|
||||
source, limit, offset,
|
||||
source,
|
||||
limit,
|
||||
offset,
|
||||
)
|
||||
elif metadata_id:
|
||||
rows = await conn.fetch(
|
||||
@@ -209,7 +224,9 @@ async def list_thoughts(
|
||||
FROM thoughts WHERE metadata->>'id' = $1
|
||||
ORDER BY created_at DESC LIMIT $2 OFFSET $3
|
||||
""",
|
||||
metadata_id, limit, offset,
|
||||
metadata_id,
|
||||
limit,
|
||||
offset,
|
||||
)
|
||||
else:
|
||||
rows = await conn.fetch(
|
||||
@@ -219,7 +236,8 @@ async def list_thoughts(
|
||||
FROM thoughts
|
||||
ORDER BY created_at DESC LIMIT $1 OFFSET $2
|
||||
""",
|
||||
limit, offset,
|
||||
limit,
|
||||
offset,
|
||||
)
|
||||
return [_row_to_thought(r) for r in rows]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user