fix main.py, added airgapped environment Dockerfile and added k8s resources folder#3
Open
Badlybear wants to merge 2 commits intoBerriAI:mainfrom
Open
fix main.py, added airgapped environment Dockerfile and added k8s resources folder#3Badlybear wants to merge 2 commits intoBerriAI:mainfrom
Badlybear wants to merge 2 commits intoBerriAI:mainfrom
Conversation
…le and added k8s resources folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
main.py:
Fixed Postgres error on file_counts updates
Replaced two assignments to the same column in one UPDATE with a single assignment (nested jsonb_set) in both single and batch endpoints.
This removes ERROR: multiple assignments to same column "file_counts" and keeps counters correct.
Made SQL result keys stable (avoid KeyError: '"id"')
Added explicit column aliases (AS id, AS content, …) in every SELECT and RETURNING.
The code now reads row["id"], row["content"], etc., reliably.
Made timestamps consistent and driver-agnostic
Converted DB timestamps to epoch seconds in SQL using EXTRACT(EPOCH FROM ...) AS ..._ts.
Removed Python .timestamp() calls (which failed when the driver returned strings).
All responses now use integer epoch fields (created_at, expires_at, last_active_at) safely.
Kept behavior but hardened pagination & limits
limit is clamped to a maximum (100).
has_more logic preserved; first_id/last_id populated from the page slice.
Safer vector search & filtering
Query embedding is computed once, cast to ::vector and used with <=>.
Metadata filters use parameterized jsonb access (metadata->>$key = $value).
Batch insert is fully parameterized
Values list constructed with positional parameters; no string interpolation of data.
Returns aliased columns for uniform response building.
Error handling & responses unchanged for API surface
Models and endpoints didn’t change shape; only internal query/row handling & stability.
Dockerfile-airgapped:
Make the image run in closed networks by baking Prisma engines into the image and pre-generating the Prisma Python client during the online build stage.
Avoid any runtime downloads; Prisma loads binaries from a local cache directory.
Keep the runtime image minimal and network-independent.