Repository navigation
Conversation
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 and why
Adds
runcrateas an explicitPGBOT_AI_PROVIDERalias forexplain/ask, following the same shape as theopperalias from #118. Runcrate serves open models over an OpenAI-compatible/chat/completionsAPI, so the existingOpenAIProvidercovers it and only the endpoint, key variable and default model differ.PGBOT_AI_PROVIDER=runcratesends/chat/completionstohttps://api.runcrate.ai/v1withRUNCRATE_API_KEY(orPGBOT_AI_API_KEY).requestyandopper.gpt-5.6-terra, so the alias defaults todeepseek-ai/DeepSeek-V4.1-Flashwhen neitherPGBOT_AI_MODELnorPGBOT_OPENAI_MODELis set. Any id fromhttps://api.runcrate.ai/v1/modelsworks throughPGBOT_AI_MODEL.Files:
internal/ai/openai.go(endpoint and default model constants),internal/ai/resolve.go(alias, key variable, default model,keyVarsFor),internal/ai/resolve_test.go(TestResolve_runcrate),README.md,CHANGELOG.md(Unreleased, Added).Keys are created at https://www.runcrate.ai/dashboard/api-keys?utm_source=pgbot&utm_medium=directory&utm_campaign=gpu_pricing .
Testing
gofmt -l .: no outputgo vet ./...: cleango test ./internal/ai/ -run TestResolve -v: all 19TestResolve_*pass, including the newTestResolve_runcrate(both key variables, endpoint, default model,PGBOT_AI_MODELoverride, refuses an OpenAI key, not auto-detected)scripts/gate.sh:HEAD builds, vets, and tests clean (6 targets)Resolve()withPGBOT_AI_PROVIDER=runcrateand a realRUNCRATE_API_KEY, thenGenerate()with a system and user turn (throwaway test, not committed).deepseek-ai/DeepSeek-V4.1-Flash(the default),zai-org/GLM-5.3-FlashandQwen/Qwen3.8-Flasheach returned"pong"withfinish_reason=stop.Checklist
scripts/gate.shpasses (builds HEAD, not just the working tree)EXPLAIN ANALYZE; findings stay deterministic (computed in Go) (no SQL touched)model.Context/--json/ the store (unchanged)--jsonchange is additive, ormodel.SchemaVersionbumped + schema regenerated (no--jsonchange)docs/findings/<id>.mdpage + catalog entry (no new finding)This PR was prepared with AI assistance: an AI coding agent wrote the change and ran the checks above.
Disclosure: I work on Runcrate.