Repository navigation
Conversation
Ask a question such as "which laptops in Berlin are free?" on the Assets page and the table narrows to the matching devices. - POST /ai/search sends the question to an OpenAI-compatible chat API, which replies with a JSON filter (status, type, brand, model, location, current holder, department, free text) - The reply is validated with Pydantic and the API builds the SQLAlchemy query itself; the model never writes SQL or touches the database - GET /ai/status tells the web UI whether AI search is configured - Off by default: enabled through ASSETFLOW_LLM_BASE_URL, ASSETFLOW_LLM_MODEL and ASSETFLOW_LLM_API_KEY; no new dependency (standard library client) - Web UI: "Ask AI" bar with the interpreted filters shown as chips - Tests with a mocked model, README section and .env.example Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017eYATpzPeBWrAevdHnoopb
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.
What this adds
An Ask AI bar on the Assets page. Type a question such as "which laptops in Berlin are free?" and the table narrows to the matching devices, with the interpreted filters shown as chips.
How it works
POST /ai/searchsends the question to an OpenAI-compatible chat API, together with the asset types, brands, locations and departments that exist in the database.The model never writes SQL and has no database access, so a manipulated question can at worst produce a wrong filter. Unknown keys are dropped; invalid values return
502.Configuration
Off by default; the app behaves exactly as before without it. Enable with
ASSETFLOW_LLM_BASE_URL,ASSETFLOW_LLM_MODELand (for hosted providers)ASSETFLOW_LLM_API_KEY. See the new README section and.env.example. No new dependency: the client uses the standard library.Testing
backend/tests/test_ai_search.py(model mocked): filters, current holder, LIKE wildcards treated literally, prose-wrapped replies, unusable replies, provider failure, input validation.Generated by Claude Code