Skip to content

Commit 7338af3

Browse files
kaushiki069pre-commit-ci[bot]PyContriveranusshuklatanwigeetika1618
authored
feat: add BYOLLM webviews (#2342)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Kaushiki Singh <kausingh@redhat.com> Co-authored-by: PyContriver <siddarthpydev@gmail.com> Co-authored-by: Siddarth Sharma <149260801+PyContriver@users.noreply.github.com> Co-authored-by: Anushka Shukla <shuklaanushka2024@gmail.com> Co-authored-by: tanwigeetika1618 <tengverified@gmail.com> Co-authored-by: Abhishekism9450 <32683845+Abhishekism9450@users.noreply.github.com> Co-authored-by: Abhishek Chaudhary <abhishekism9450@gmail.com> Co-authored-by: tanwigeetika1618 <84617407+tanwigeetika1618@users.noreply.github.com>
1 parent 13a2e1b commit 7338af3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+6143
-104
lines changed

.config/dictionary.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Infiles
1414
KUBEDOCK
1515
Konflux
1616
LIGHTSPEED
17+
LLMPROVIDER
1718
Lightspeed
1819
Lightspeed's
1920
Maciążek
@@ -42,6 +43,7 @@ codeclimate
4243
codespell
4344
contentmatch
4445
contentmatches
46+
contentmatching
4547
coreutils
4648
cpython
4749
dedupe
@@ -68,6 +70,7 @@ libonig
6870
libssh
6971
lightspeed
7072
lineinfile
73+
llmprovider
7174
maxlength
7275
microdnf
7376
mocharc
@@ -78,6 +81,7 @@ mymodule
7881
mynamespace
7982
myorg
8083
myproject
84+
myrole
8185
nocolor
8286
noheading
8387
norecursedirs

docs/configuration.md

Lines changed: 42 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,49 @@ any level (User, Remote, Workspace and/or Folder).
6464

6565
## Lightspeed Configuration
6666

67-
- `ansible.lightspeed.enabled`: Enable Ansible Lightspeed.
68-
- `ansible.lightspeed.URL`: URL for Ansible Lightspeed.
69-
- `ansible.lightspeed.suggestions.enabled`: Enable Ansible Lightspeed with
70-
watsonx Code Assistant inline suggestions.
67+
### Core Settings
68+
69+
- `ansible.lightspeed.enabled`: Enable/disable Ansible Lightspeed.
70+
- `ansible.lightspeed.provider`: Select AI provider (`wca`, `google`).
71+
- `wca`: Red Hat Ansible Lightspeed with IBM watsonx Code Assistant (default)
72+
- `google`: Google Gemini API access
73+
74+
- `ansible.lightspeed.apiEndpoint`: API endpoint URL for the selected provider.
75+
- For WCA: `https://c.ai.ansible.redhat.com` (default)
76+
- For Google: `https://generativelanguage.googleapis.com/v1beta`
77+
78+
- `ansible.lightspeed.modelName`: Model name/ID to use.
79+
- For WCA: Model ID override (optional, for commercial users)
80+
- For LLM providers: Required model identifier (e.g., `gemini-2.5-flash`)
81+
82+
- `ansible.lightspeed.apiKey`: API key for LLM providers.
83+
- Not used for WCA (uses OAuth2 authentication)
84+
- Required for `google` provider
85+
86+
- `ansible.lightspeed.timeout`: Request timeout in milliseconds (default: 30000).
87+
88+
### Inline Suggestions
89+
90+
- `ansible.lightspeed.suggestions.enabled`: Enable inline suggestions.
91+
- Note: Currently only supported with WCA provider
92+
7193
- `ansible.lightspeed.suggestions.waitWindow`: Delay (in milliseconds) prior to
72-
sending an inline suggestion request to Ansible Lightspeed with watsonx Code
73-
Assistant.
74-
- `ansible.lightspeed.modelIdOverride`: Model ID to override your organization's
75-
default model. This setting is only applicable to commercial users with an
76-
Ansible Lightspeed seat assignment.
94+
sending an inline suggestion request.
95+
96+
### Advanced Settings
97+
98+
- `ansible.lightspeed.customHeaders`: Custom HTTP headers for LLM providers (JSON object).
99+
- Example: `{"Custom-Header": "value"}`
100+
- Not used for WCA
101+
102+
### Backward Compatibility
103+
104+
The following legacy settings are still supported for backward compatibility:
105+
106+
- `ansible.lightspeed.URL`: Mapped to `ansible.lightspeed.apiEndpoint`
107+
- `ansible.lightspeed.modelIdOverride`: Mapped to `ansible.lightspeed.modelName`
108+
109+
See [LLM Provider Documentation](llm-providers.md) for detailed setup instructions and examples.
77110

78111
## Completion & Language Server Settings
79112

package.json

Lines changed: 63 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,22 @@
209209
{
210210
"command": "ansible.mcpServer.disable",
211211
"title": "Disable Ansible Development Tools MCP Server"
212+
},
213+
{
214+
"command": "ansible.lightspeed.testProviderConnection",
215+
"title": "Ansible Lightspeed: Test Provider Connection"
216+
},
217+
{
218+
"command": "ansible.lightspeed.configureLlmProvider",
219+
"title": "Ansible Lightspeed: Configure LLM Provider"
220+
},
221+
{
222+
"command": "ansible.lightspeed.showProviderStatus",
223+
"title": "Ansible Lightspeed: Show Provider Status"
224+
},
225+
{
226+
"command": "ansible.lightspeed.switchProvider",
227+
"title": "Ansible Lightspeed: Switch Provider"
212228
}
213229
],
214230
"configuration": [
@@ -415,39 +431,73 @@
415431
},
416432
{
417433
"properties": {
434+
"ansible.lightspeed.apiEndpoint": {
435+
"default": "",
436+
"markdownDescription": "API endpoint URL. **Only configurable for WCA provider.** For Google, the endpoint is automatically set and cannot be changed. Default for WCA: https://c.ai.ansible.redhat.com",
437+
"order": 4,
438+
"scope": "resource",
439+
"type": "string"
440+
},
441+
"ansible.lightspeed.apiKey": {
442+
"markdownDescription": "API key for Google provider. Not used for WCA (uses OAuth2 authentication). **Important**: This will be stored in VS Code settings.",
443+
"order": 3,
444+
"scope": "resource",
445+
"type": "string"
446+
},
447+
"ansible.lightspeed.customHeaders": {
448+
"markdownDescription": "Custom HTTP headers for LLM providers (JSON object). Example: {\"Custom-Header\": \"value\"}. Not used for WCA.",
449+
"order": 6,
450+
"scope": "resource",
451+
"type": "object"
452+
},
418453
"ansible.lightspeed.enabled": {
419454
"default": true,
420455
"markdownDescription": "Enable Ansible Lightspeed.",
421456
"order": 0,
422457
"scope": "resource",
423458
"type": "boolean"
424459
},
425-
"ansible.lightspeed.modelIdOverride": {
426-
"markdownDescription": "Model ID to override your organization's default model. This setting is only applicable to commercial users with an Ansible Lightspeed seat assignment.",
427-
"order": 4,
460+
"ansible.lightspeed.modelName": {
461+
"markdownDescription": "Model name/ID to use. **Optional for Google** (uses smart defaults). For WCA: Model ID to override your organization's default model (commercial users only).",
462+
"order": 2,
463+
"scope": "resource",
464+
"type": "string"
465+
},
466+
"ansible.lightspeed.provider": {
467+
"default": "wca",
468+
"enum": [
469+
"wca",
470+
"google"
471+
],
472+
"enumDescriptions": [
473+
"Red Hat Ansible Lightspeed with IBM watsonx Code Assistant",
474+
"Google Gemini - Direct access to Google Gemini models (use your Google API key)"
475+
],
476+
"markdownDescription": "Select the AI provider for Ansible Lightspeed suggestions and generation.",
477+
"order": 1,
428478
"scope": "resource",
429479
"type": "string"
430480
},
431481
"ansible.lightspeed.suggestions.enabled": {
432482
"default": true,
433-
"markdownDescription": "Enable Ansible Lightspeed with watsonx Code Assistant inline suggestions.",
434-
"order": 2,
483+
"markdownDescription": "Enable inline suggestions. Note: Currently only supported with WCA provider.",
484+
"order": 7,
435485
"scope": "resource",
436486
"type": "boolean"
437487
},
438488
"ansible.lightspeed.suggestions.waitWindow": {
439489
"default": 0,
440-
"markdownDescription": "Delay (in msecs) prior to sending an inline suggestion request to Ansible Lightspeed with watsonx Code Assistant.",
441-
"order": 3,
490+
"markdownDescription": "Delay (in msecs) prior to sending an inline suggestion request.",
491+
"order": 8,
442492
"scope": "resource",
443493
"type": "number"
444494
},
445-
"ansible.lightspeed.URL": {
446-
"default": "https://c.ai.ansible.redhat.com",
447-
"markdownDescription": "URL for Ansible Lightspeed.",
448-
"order": 1,
495+
"ansible.lightspeed.timeout": {
496+
"default": 3000,
497+
"markdownDescription": "Request timeout in milliseconds for API calls.",
498+
"order": 5,
449499
"scope": "resource",
450-
"type": "string"
500+
"type": "number"
451501
}
452502
},
453503
"title": "Ansible Lightspeed"
@@ -742,7 +792,7 @@
742792
{
743793
"icon": "$(comment-discussion)",
744794
"id": "lightspeed-feedback-webview",
745-
"name": "Ansible Lightspeed Feedback",
795+
"name": "Ansible Lightspeed WCA Provider Feedback",
746796
"type": "webview",
747797
"when": "config.ansible.lightspeed.enabled"
748798
}

src/definitions/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Write one paragraph per Ansible task.
9393
Markdown title starts with the '#' character.
9494
Write a title before every paragraph.
9595
Do not return any YAML or Ansible in the output.
96-
Give a lot of details regarding the parameters of each Ansible plugin.`;
96+
Give details regarding the parameters of each Ansible plugin.`;
9797

9898
// Template for playbook generation
9999
export const ANSIBLE_PLAYBOOK_GENERATION_TEMPLATE = `This is what the playbook should do: {PROMPT}`;

0 commit comments

Comments
 (0)