Vtk prompt fixes#42
Merged
Merged
Conversation
…o 'import vtkY'
Shared ensure_vtk_importable() replaces the brittle find('import vtk') slice in
client.py and code_executor.py; bump UI retry_attempts default to 3 so the
validation feedback loop can act. Adds regression tests.
…orts base_url Lets a single --prompt-file restore local provider, Ollama base URL, model, vtk-mcp URL, retries and params without re-typing in the UI.
…prompt.yml, ~/.config/vtk-prompt/config.yml) and loads .env
…hen the key comes from .env/env, not just manual entry
…y, not prompts; client falls back to built-in assembly
…d-code vars from scalar guards (dunder/length)
… (single namespace) so guarded main() scripts run; inject render_window
Merged
Member
|
I cant seem to submit a query (enter or ctrl-enter does not work) The issue seems to be only happening with local models. Also happens in #43 Screencast.from.2026-06-17.20-44-32.webm |
Collaborator
Author
|
if you go and set the API key in the settings->model tab then the Generate Code button will appear. AFAIK that has been the behavior that api key required even for local models. I just set to ollama but we can revisit the logic to just not require a key if running a local model. |
In local mode the OpenAI-compatible endpoint (Ollama, LM Studio, ...) ignores auth, but two things blocked submitting a query without a key: the Generate Code button was gated on a non-empty api_token, so it never appeared, and the client refuses to construct an OpenAI client with an empty key. Show the button whenever a key is not required (local mode) or one is present (cloud), and fall back to a placeholder key in local mode that a real key typed into the field overrides. Cloud providers (OpenAI, Anthropic, Gemini, NIM) still require a real key, so an empty key there still surfaces the "Set API Key" prompt as before.
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.
Summary
A batch of independent bug and UX fixes for the vtk-prompt UI and its
vtk-mcp / config plumbing. These accumulated while building the editor
work and don't depend on it, so they're split out here to land on their
own. The editor feature builds on this branch and follows in a separate
PR.
Config and startup
VTK_PROMPT_CONFIG,./vtk-prompt.yml,~/.config/vtk-prompt/config.yml) and loads.env,so
vtk-prompt-uicomes up configured without explicit flags.mcp_urlandbase_url, andsave_configwritesbase_urlback out (previouslydropped on save).
api_tokenis seeded fromOPENAI_API_KEY, so the Generate buttonappears when the key comes from
.envor the environment rather thanonly from manual entry in the dialog.
vtk-mcp integration and prompt assembly
on
mcp_url, matching the move to delegate VTK knowledge to vtk-mcp.messageskey aresettings-only, not prompts, so the client now falls back to built-in
prompt assembly instead of sending an empty request.
context_snippetsbeing rejected as "dangerous": thescalar guards (dunder / length checks) now exempt trusted
retrieved-code variables.
Code generation and rendering
__name__ == "__main__"in a single namespace so scripts guarded byif __name__ == "__main__":actually run, andrender_windowisinjected alongside
renderer. Without this the guarded scripts no-op'dto a blank view.
from vtkmodules.X import vtkYdown toimport vtkY.UI
persistent_placeholderon the prompt textarea to stop the labeland placeholder text overlapping.
Notes
Base is
master. The editor / completion feature is stacked on top ofthis branch in a follow-up PR; merging this first lets that PR retarget
to
mastercleanly.