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,
|
RETURNING id::text, content, source, metadata, created_at,
|
||||||
embedding IS NOT NULL AS embedded
|
embedding IS NOT NULL AS embedded
|
||||||
""",
|
""",
|
||||||
new_content, new_source, new_metadata, vec, uid,
|
new_content,
|
||||||
|
new_source,
|
||||||
|
new_metadata,
|
||||||
|
vec,
|
||||||
|
uid,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
updated = await conn.fetchrow(
|
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,
|
RETURNING id::text, content, source, metadata, created_at,
|
||||||
embedding IS NOT NULL AS embedded
|
embedding IS NOT NULL AS embedded
|
||||||
""",
|
""",
|
||||||
new_content, new_source, new_metadata, uid,
|
new_content,
|
||||||
|
new_source,
|
||||||
|
new_metadata,
|
||||||
|
uid,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
updated = await conn.fetchrow(
|
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,
|
RETURNING id::text, content, source, metadata, created_at,
|
||||||
embedding IS NOT NULL AS embedded
|
embedding IS NOT NULL AS embedded
|
||||||
""",
|
""",
|
||||||
new_source, new_metadata, uid,
|
new_source,
|
||||||
|
new_metadata,
|
||||||
|
uid,
|
||||||
)
|
)
|
||||||
|
|
||||||
return _row_to_thought(updated)
|
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:
|
if source and metadata_id:
|
||||||
result = await conn.execute(
|
result = await conn.execute(
|
||||||
"DELETE FROM thoughts WHERE source = $1 AND metadata->>'id' = $2",
|
"DELETE FROM thoughts WHERE source = $1 AND metadata->>'id' = $2",
|
||||||
source, metadata_id,
|
source,
|
||||||
|
metadata_id,
|
||||||
)
|
)
|
||||||
elif source:
|
elif source:
|
||||||
result = await conn.execute("DELETE FROM thoughts WHERE source = $1", 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
|
WHERE source = $1 AND metadata->>'id' = $2
|
||||||
ORDER BY created_at DESC LIMIT $3 OFFSET $4
|
ORDER BY created_at DESC LIMIT $3 OFFSET $4
|
||||||
""",
|
""",
|
||||||
source, metadata_id, limit, offset,
|
source,
|
||||||
|
metadata_id,
|
||||||
|
limit,
|
||||||
|
offset,
|
||||||
)
|
)
|
||||||
elif source:
|
elif source:
|
||||||
rows = await conn.fetch(
|
rows = await conn.fetch(
|
||||||
@@ -199,7 +212,9 @@ async def list_thoughts(
|
|||||||
FROM thoughts WHERE source = $1
|
FROM thoughts WHERE source = $1
|
||||||
ORDER BY created_at DESC LIMIT $2 OFFSET $3
|
ORDER BY created_at DESC LIMIT $2 OFFSET $3
|
||||||
""",
|
""",
|
||||||
source, limit, offset,
|
source,
|
||||||
|
limit,
|
||||||
|
offset,
|
||||||
)
|
)
|
||||||
elif metadata_id:
|
elif metadata_id:
|
||||||
rows = await conn.fetch(
|
rows = await conn.fetch(
|
||||||
@@ -209,7 +224,9 @@ async def list_thoughts(
|
|||||||
FROM thoughts WHERE metadata->>'id' = $1
|
FROM thoughts WHERE metadata->>'id' = $1
|
||||||
ORDER BY created_at DESC LIMIT $2 OFFSET $3
|
ORDER BY created_at DESC LIMIT $2 OFFSET $3
|
||||||
""",
|
""",
|
||||||
metadata_id, limit, offset,
|
metadata_id,
|
||||||
|
limit,
|
||||||
|
offset,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
rows = await conn.fetch(
|
rows = await conn.fetch(
|
||||||
@@ -219,7 +236,8 @@ async def list_thoughts(
|
|||||||
FROM thoughts
|
FROM thoughts
|
||||||
ORDER BY created_at DESC LIMIT $1 OFFSET $2
|
ORDER BY created_at DESC LIMIT $1 OFFSET $2
|
||||||
""",
|
""",
|
||||||
limit, offset,
|
limit,
|
||||||
|
offset,
|
||||||
)
|
)
|
||||||
return [_row_to_thought(r) for r in rows]
|
return [_row_to_thought(r) for r in rows]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user