Repository navigation
feat(yasgui): AI assistant for writing, explaining and fixing queries - #239
Merged
Merged
Conversation
…queries Natural language to SPARQL, explain query, fix query (errors and empty results) and explain results, in a new AI view of the side panel. Works with any OpenAI-compatible API, with the user's own key or a proxy of the embedding site (ai.proxy). Without a service the actions copy a prompt (Copy for AI). A privacy notice shows what is sent before the first request, and every answer shows the exact request. The model gets the endpoint's classes and properties as context and may run small read-only check queries. yasr gets hostApi.assistant, askAssistant() and Fix with AI / Copy for AI in the error view; yasqe keeps the first syntax error in syntaxError.
…mode text Requests to api.anthropic.com send the header Anthropic requires for browser requests, and a base URL pasted with /messages or /chat/completions is trimmed. Labels and choices of the AI settings now use the theme's text colour.
Document the provider specifics in the user guide: Gemini base URL, Azure deployments, LM Studio CORS and the browser's local network prompt.
…I view Settings → AI lists the site's services and the user's own, with a default. The Base URL field suggests popular providers (OpenAI, Anthropic, Gemini, Mistral, Kimi, …). ai.proxy also accepts a list. Settings of the single-service version are migrated.
…s, use the Yasgui font in the settings
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.
Requested by Mathias · project thread
What
A new AI view in the side panel. You open it with the AI button in the editor toolbar or with Ask AI… in Ctrl+K. It has four features:
Each query in an answer has four buttons: Use in editor (Ctrl+Z undoes it), Insert, New tab and Copy. Nothing runs automatically.
Where the LLM runs
ai.proxy(url,label,model,headers,withCredentials,privacyUrl). The developer guide includes a minimal Express proxy.ai: { enabled: false }removes all of it.allowOwnKey: falseallows the proxy only.Privacy
<persistenceId>_ai). It is not part of the persisted config, so export and share links never contain it. A test checks this.Endpoint context and check queries
endpointDescribe.getAutocompleteTerms()(the same source as autocomplete). They also send the prefixes in use.run_sparqltool for up to 5 check queries per question. Only SELECT and ASK are allowed, the LIMIT is forced to 20 or less, and the query runs throughtab.runBackgroundQuerywith the tab's auth.tools, the request is retried without them.Architecture
packages/yasgui/src/ai/folder:AiAssistant: tasks, consent and the tool loopAiPanel: the side panel viewAiSettingsFormopenaiClientpromptsschemaContextcheckQuerymarkdownaiSettingshostApi.assistantyasr.askAssistant({ title, prompt, context }), so plugins (chart, explain…) can add their own "Explain this" action without handling keysassistantconfig hook that the error view usesyasqe.syntaxErrorstores the first syntax error.SidePanel.addView(..., { before })keeps the view order Queries / Endpoint / AI.data-tabinstead of by index.Docs and tests
yasgui.aiAssistant, and the plugin host API.Screenshots are in the project files (
ai-support/screenshots/).Generated by Claude Code