diff --git a/aiprompts/overview.md b/.roo/rules/overview.md similarity index 100% rename from aiprompts/overview.md rename to .roo/rules/overview.md diff --git a/.roo/rules/rules.md b/.roo/rules/rules.md new file mode 100644 index 0000000000..519bacf82c --- /dev/null +++ b/.roo/rules/rules.md @@ -0,0 +1,109 @@ +Wave Terminal is a modern terminal which provides graphical blocks, dynamic layout, workspaces, and SSH connection management. It is cross platform and built on electron. + +### Project Structure + +It has a TypeScript/React frontend and a Go backend. They talk together over `wshrpc` a custom RPC protocol that is implemented over websocket (and domain sockets). + +### Coding Guidelines + +- **Go Conventions**: + - Don't use custom enum types in Go. Instead, use string constants (e.g., `const StatusRunning = "running"` rather than creating a custom type like `type Status string`). + - Use string constants for status values, packet types, and other string-based enumerations. + - in Go code, prefer using Printf() vs Println() + - use "Make" as opposed to "New" for struct initialization func names + - in general const decls go at the top fo the file (before types and functions) + - NEVER run `go build` (especially in weird sub-package directories). we can tell if everything compiles by seeing there are no problems/errors. +- **Synchronization**: + - Always prefer to use the `lock.Lock(); defer lock.Unlock()` pattern for synchronization if possible + - Avoid inline lock/unlock pairs - instead create helper functions that use the defer pattern + - When accessing shared data structures (maps, slices, etc.), ensure proper locking + - Example: Instead of `gc.lock.Lock(); gc.map[key]++; gc.lock.Unlock()`, create a helper function like `getNextValue(key string) int { gc.lock.Lock(); defer gc.lock.Unlock(); gc.map[key]++; return gc.map[key] }` +- **TypeScript Imports**: + - Use `@/...` for imports from different parts of the project (configured in `tsconfig.json` as `"@/*": ["frontend/*"]`). + - Prefer relative imports (`"./name"`) only within the same directory. + - Use named exports exclusively; avoid default exports. It's acceptable to export functions directly (e.g., React Components). + - Our indent is 4 spaces +- **JSON Field Naming**: All fields must be lowercase, without underscores. +- **TypeScript Conventions** + - **Type Handling**: + - In TypeScript we have strict null checks off, so no need to add "| null" to all the types. + - In TypeScript for Jotai atoms, if we want to write, we need to type the atom as a PrimitiveAtom + - Jotai has a bug with strict null checks off where if you create a null atom, e.g. atom(null) it does not "type" correctly. That's no issue, just cast it to the proper PrimitiveAtom type (no "| null") and it will work fine. + - Generally never use "=== undefined" or "!== undefined". This is bad style. Just use a "== null" or "!= null" unless it is a very specific case where we need to distinguish undefined from null. + - **Coding Style**: + - Use all lowercase filenames (except where case is actually important like Taskfile.yml) + - Import the "cn" function from "@/util/util" to do classname / clsx class merge (it uses twMerge underneath) + - For element variants use class-variance-authority + - **Component Practices**: + - Make sure to add cursor-pointer to buttons/links and clickable items + - NEVER use cursor-help (it looks terrible) + - useAtom() and useAtomValue() are react HOOKS, so they must be called at the component level not inline in JSX + - If you use React.memo(), make sure to add a displayName for the component + +### Styling + +- We use tailwind v4 to style. Custom stuff is defined in tailwindsetup.css. +- _never_ use cursor-help (it looks terrible) +- We have custom CSS setup as well, so it is a hybrid system. For new code we prefer tailwind, and are working to migrate code to all use tailwind. + +### Code Generation + +- **TypeScript Types**: TypeScript types are automatically generated from Go types. After modifying Go types in `pkg/wshrpc/wshrpctypes.go`, run `task generate` to update the TypeScript type definitions in `frontend/types/gotypes.d.ts`. +- **Manual Edits**: Do not manually edit generated files like `frontend/types/gotypes.d.ts` or `frontend/app/store/wshclientapi.ts`. Instead, modify the source Go types and run `task generate`. + +### Documentation References + +Found in /aiprompts + +- config-system.md -- for help with adding new config or settings values +- contextmenu.md +- getsetconfigvar.md +- view-prompt.md -- view model guide + +### Frontend Architecture + +- The application uses Jotai for state management. +- When working with Jotai atoms that need to be updated, define them as `PrimitiveAtom` rather than just `atom`. + +### Notes + +- **CRITICAL: Completion format MUST be: "Done: [one-line description]"** +- **Keep your Task Completed summaries VERY short** +- **No lengthy pre-completion summaries** - Do not provide detailed explanations of implementation before using attempt_completion +- **No recaps of changes** - Skip explaining what was done before completion +- **Go directly to completion** - After making changes, proceed directly to attempt_completion without summarizing +- The project is currently an un-released POC / MVP. Do not worry about backward compatibility when making changes +- With React hooks, always complete all hook calls at the top level before any conditional returns (including jotai hook calls useAtom and useAtomValue); when a user explicitly tells you a function handles null inputs, trust them and stop trying to "protect" it with unnecessary checks or workarounds. +- **Match response length to question complexity** - For simple, direct questions in Ask mode (especially those that can be answered in 1-2 sentences), provide equally brief answers. Save detailed explanations for complex topics or when explicitly requested. +- **CRITICAL** - useAtomValue and useAtom are React HOOKS. They cannot be used inline in JSX code, they must appear at the top of a component in the hooks area of the react code. + +### Strict Comment Rules + +- **NEVER add comments that merely describe what code is doing**: + - ❌ `mutex.Lock() // Lock the mutex` + - ❌ `counter++ // Increment the counter` + - ❌ `buffer.Write(data) // Write data to buffer` + - ❌ `// Header component for app run list` (above AppRunListHeader) + - ❌ `// Updated function to include onClick parameter` + - ❌ `// Changed padding calculation` + - ❌ `// Removed unnecessary div` + - ❌ `// Using the model's width value here` +- **Only use comments for**: + - Explaining WHY a particular approach was chosen + - Documenting non-obvious edge cases or side effects + - Warning about potential pitfalls in usage + - Explaining complex algorithms that can't be simplified +- **When in doubt, leave it out**. No comment is better than a redundant comment. +- **Never add comments explaining code changes** - The code should speak for itself, and version control tracks changes. The one exception to this rule is if it is a very unobvious implementation. Something that someone would typically implement in a different (wrong) way. Then the comment helps us remember WHY we changed it to a less obvious implementation. + +### Tool Use + +Do NOT use write_to_file unless it is a new file or very short. Always prefer to use replace_in_file. Often your diffs fail when a file may be out of date in your cache vs the actual on-disk format. You should RE-READ the file and try to create diffs again if your diffs fail rather than fall back to write_to_file. If you feel like your ONLY option is to use write_to_file please ask first. + +Also when adding content to the end of files prefer to use the new append_file tool rather than trying to create a diff (as your diffs are often not specific enough and end up inserting code in the middle of existing functions). + +### Directory Awareness + +- **ALWAYS verify the current working directory before executing commands** +- Either run "pwd" first to verify the directory, or do a "cd" to the correct absolute directory before running commands +- When running tests, do not "cd" to the pkg directory and then run the test. This screws up the cwd and you never recover. run the test from the project root instead. diff --git a/aiprompts/config-system.md b/aiprompts/config-system.md new file mode 100644 index 0000000000..ad06fb3468 --- /dev/null +++ b/aiprompts/config-system.md @@ -0,0 +1,324 @@ +# Wave Terminal Configuration System + +This document explains how Wave Terminal's configuration system works and provides step-by-step instructions for adding new configuration values. + +## Overview + +Wave Terminal uses a hierarchical configuration system with the following components: + +1. **Go Struct Definitions** - Type-safe configuration structure in Go +2. **JSON Schema** - Validation schema for configuration files +3. **Default Values** - Built-in default configuration +4. **User Configuration** - User-customizable settings in `~/.config/waveterm/settings.json` +5. **Documentation** - User-facing documentation + +## Configuration File Structure + +Wave Terminal's configuration system is organized into several key directories and files: + +``` +waveterm/ +├── pkg/wconfig/ # Go configuration package +│ ├── settingsconfig.go # Main settings struct definitions +│ ├── defaultconfig/ # Default configuration files +│ │ ├── settings.json # Default settings values +│ │ ├── termthemes.json # Default terminal themes +│ │ ├── presets.json # Default background presets +│ │ └── widgets.json # Default widget configurations +│ └── ... # Other config-related Go files +├── schema/ # JSON Schema definitions +│ ├── settings.json # Settings validation schema +│ └── ... # Other schema files +├── docs/docs/ # User documentation +│ └── config.mdx # Configuration documentation +└── ~/.config/waveterm/ # User config directory (runtime) + ├── settings.json # User settings overrides + ├── termthemes.json # User terminal themes + ├── presets.json # User background presets + ├── widgets.json # User widget configurations + ├── bookmarks.json # Web bookmarks + └── connections.json # SSH/remote connections +``` + +**Key Files:** +- **[`pkg/wconfig/settingsconfig.go`](pkg/wconfig/settingsconfig.go)** - Defines the `SettingsType` struct with all configuration fields +- **[`schema/settings.json`](schema/settings.json)** - JSON Schema for validation and type checking +- **[`pkg/wconfig/defaultconfig/settings.json`](pkg/wconfig/defaultconfig/settings.json)** - Default values for all settings +- **[`docs/docs/config.mdx`](docs/docs/config.mdx)** - User-facing documentation with descriptions and examples + +## Configuration Architecture + +### Configuration Hierarchy + +1. **Built-in Defaults** (`pkg/wconfig/defaultconfig/settings.json`) +2. **User Settings** (`~/.config/waveterm/settings.json`) +3. **Block-level Overrides** (stored in block metadata) + +Settings cascade from defaults → user settings → block overrides. + +## How to Add a New Configuration Value + +Follow these steps to add a new configuration setting: + +### Step 1: Add to Go Struct Definition + +Edit [`pkg/wconfig/settingsconfig.go`](pkg/wconfig/settingsconfig.go) and add your new field to the `SettingsType` struct: + +```go +type SettingsType struct { + // ... existing fields ... + + // Add your new field with appropriate JSON tag + MyNewSetting string `json:"mynew:setting,omitempty"` + + // For different types: + MyBoolSetting bool `json:"mynew:boolsetting,omitempty"` + MyNumberSetting float64 `json:"mynew:numbersetting,omitempty"` + MyIntSetting *int64 `json:"mynew:intsetting,omitempty"` // Use pointer for optional ints + MyArraySetting []string `json:"mynew:arraysetting,omitempty"` +} +``` + +**Naming Conventions:** + +- Use namespace prefixes (e.g., `term:`, `window:`, `ai:`, `web:`) +- Use lowercase with colons as separators +- Field names should be descriptive and follow Go naming conventions +- Use `omitempty` tag to exclude empty values from JSON + +**Type Guidelines:** + +- Use `*int64` and `*float64` for optional numeric values +- Use `*bool` for optional boolean values +- Use `string` for text values +- Use `[]string` for arrays +- Use `float64` for numbers that can be decimals + +### Step 2: Add to JSON Schema + +Edit [`schema/settings.json`](schema/settings.json) and add your field to the `properties` section: + +```json +{ + "$defs": { + "SettingsType": { + "properties": { + // ... existing properties ... + + "mynew:setting": { + "type": "string" + }, + "mynew:boolsetting": { + "type": "boolean" + }, + "mynew:numbersetting": { + "type": "number" + }, + "mynew:intsetting": { + "type": "integer" + }, + "mynew:arraysetting": { + "items": { + "type": "string" + }, + "type": "array" + } + } + } + } +} +``` + +**Schema Type Mapping:** + +- Go `string` → JSON Schema `"string"` +- Go `bool` → JSON Schema `"boolean"` +- Go `float64` → JSON Schema `"number"` +- Go `int64` → JSON Schema `"integer"` +- Go `[]string` → JSON Schema `"array"` with `"items": {"type": "string"}` + +### Step 3: Set Default Value (Optional) + +If your setting should have a default value, add it to [`pkg/wconfig/defaultconfig/settings.json`](pkg/wconfig/defaultconfig/settings.json): + +```json +{ + "ai:preset": "ai@global", + "ai:model": "gpt-4o-mini", + // ... existing defaults ... + + "mynew:setting": "default value", + "mynew:boolsetting": true, + "mynew:numbersetting": 42.5, + "mynew:intsetting": 100 +} +``` + +**Default Value Guidelines:** + +- Only add defaults for settings that should have non-zero/non-empty initial values +- Ensure defaults make sense for the typical user experience +- Keep defaults conservative and safe + +### Step 4: Update Documentation + +Add your new setting to the configuration table in [`docs/docs/config.mdx`](docs/docs/config.mdx): + +```markdown +| Key Name | Type | Function | +| ------------------- | -------- | ----------------------------------------- | +| mynew:setting | string | Description of what this setting controls | +| mynew:boolsetting | bool | Enable/disable some feature | +| mynew:numbersetting | float | Numeric setting for some parameter | +| mynew:intsetting | int | Integer setting for some configuration | +| mynew:arraysetting | string[] | Array of strings for multiple values | +``` + +Also update the default configuration example in the same file if you added defaults. + +### Step 5: Regenerate Schema and TypeScript Types + +Run the build tasks to regenerate schema and TypeScript types: + +```bash +task build:schema +task generate +``` + +Or run them individually: +```bash +# Regenerate JSON schema +task build:schema + +# Regenerate TypeScript types +go run cmd/generatets/main-generatets.go +``` + +This will update the schema files and [`frontend/types/gotypes.d.ts`](frontend/types/gotypes.d.ts) with your new settings. + +### Step 6: Use in Frontend Code + +Access your new setting in React components: + +```typescript +import { useSettingsKeyAtom } from "@/app/store/global"; + +// In a React component +const MyComponent = () => { + // Read global setting with fallback + const mySetting = useSettingsKeyAtom("mynew:setting") ?? "fallback value"; + + // For block-specific overrides + const myBlockSetting = useOverrideConfigAtom(blockId, "mynew:setting") ?? "fallback"; + + return
Setting value: {mySetting}
; +}; +``` + +### Step 7: Use in Backend Code + +Access settings in Go code: + +```go +// Get the full config +fullConfig := wconfig.GetWatcher().GetFullConfig() + +// Access your setting +myValue := fullConfig.Settings.MyNewSetting +``` + +## Configuration Patterns + +### Namespace Organization + +Settings are organized by namespace using colon separators: + +- `app:*` - Application-level settings +- `term:*` - Terminal-specific settings +- `window:*` - Window and UI settings +- `ai:*` - AI-related settings +- `web:*` - Web browser settings +- `editor:*` - Code editor settings +- `conn:*` - Connection settings + +### Clear/Reset Pattern + +Each namespace can have a "clear" field for resetting all settings in that namespace: + +```go +AppClear bool `json:"app:*,omitempty"` +TermClear bool `json:"term:*,omitempty"` +``` + +### Optional vs Required Settings + +- Use pointer types (`*bool`, `*int64`, `*float64`) for truly optional settings +- Use regular types for settings that should always have a value +- Provide sensible defaults for important settings + +### Block-Level Overrides + +Settings can be overridden at the block level using metadata: + +```typescript +// Set block-specific override +await RpcApi.SetMetaCommand(TabRpcClient, { + oref: WOS.makeORef("block", blockId), + meta: { "mynew:setting": "block-specific value" }, +}); +``` + +## Example: Adding a New Terminal Setting + +Let's walk through adding a new terminal setting `term:bellsound`: + +### 1. Go Struct (settingsconfig.go) + +```go +type SettingsType struct { + // ... existing fields ... + TermBellSound string `json:"term:bellsound,omitempty"` +} +``` + +### 2. JSON Schema (schema/settings.json) + +```json +{ + "properties": { + "term:bellsound": { + "type": "string" + } + } +} +``` + +### 3. Default Value (defaultconfig/settings.json) + +```json +{ + "term:bellsound": "default" +} +``` + +### 4. Documentation (docs/config.mdx) + +```markdown +| term:bellsound | string | Sound to play for terminal bell ("default", "none", or custom sound file path) | +``` + +### 5. Frontend Usage + +```typescript +const bellSound = useOverrideConfigAtom(blockId, "term:bellsound") ?? "default"; +``` + +## Testing Your Configuration + +1. **Build and run** Wave Terminal with your changes +2. **Test default behavior** - Ensure the default value works +3. **Test user override** - Add your setting to `~/.config/waveterm/settings.json` +4. **Test block override** - Set block-specific metadata +5. **Verify schema validation** - Ensure invalid values are rejected + +## Common Pitfalls diff --git a/frontend/app/view/waveai/waveai.tsx b/frontend/app/view/waveai/waveai.tsx index 3ed852a780..3c36087cc8 100644 --- a/frontend/app/view/waveai/waveai.tsx +++ b/frontend/app/view/waveai/waveai.tsx @@ -187,6 +187,7 @@ export class WaveAiModel implements ViewModel { maxtokens: mergedPresets["ai:maxtokens"] ?? null, timeoutms: mergedPresets["ai:timeoutms"] ?? 60000, baseurl: mergedPresets["ai:baseurl"] ?? null, + proxyurl: mergedPresets["ai:proxyurl"] ?? null, }; return opts; }); diff --git a/frontend/types/gotypes.d.ts b/frontend/types/gotypes.d.ts index 4f399e0e34..13868f341b 100644 --- a/frontend/types/gotypes.d.ts +++ b/frontend/types/gotypes.d.ts @@ -559,7 +559,6 @@ declare global { "editor:minimapenabled"?: boolean; "editor:stickyscrollenabled"?: boolean; "editor:wordwrap"?: boolean; - "editor:fontsize"?: number; "graph:*"?: boolean; "graph:numpoints"?: number; "graph:metrics"?: string[]; @@ -693,6 +692,7 @@ declare global { "ai:apiversion"?: string; "ai:maxtokens"?: number; "ai:timeoutms"?: number; + "ai:proxyurl"?: string; "ai:fontsize"?: number; "ai:fixedfontsize"?: number; "term:*"?: boolean; @@ -1168,6 +1168,7 @@ declare global { orgid?: string; apiversion?: string; baseurl?: string; + proxyurl?: string; maxtokens?: number; maxchoices?: number; timeoutms?: number; diff --git a/pkg/waveai/anthropicbackend.go b/pkg/waveai/anthropicbackend.go index 81a07e881d..496d73b075 100644 --- a/pkg/waveai/anthropicbackend.go +++ b/pkg/waveai/anthropicbackend.go @@ -11,6 +11,7 @@ import ( "fmt" "io" "net/http" + "net/url" "strings" "github.com/wavetermdev/waveterm/pkg/panichandler" @@ -180,7 +181,20 @@ func (AnthropicBackend) StreamCompletion(ctx context.Context, request wshrpc.Wav req.Header.Set("x-api-key", request.Opts.APIToken) req.Header.Set("anthropic-version", "2023-06-01") + // Configure HTTP client with proxy if specified client := &http.Client{} + if request.Opts.ProxyURL != "" { + proxyURL, err := url.Parse(request.Opts.ProxyURL) + if err != nil { + rtn <- makeAIError(fmt.Errorf("invalid proxy URL: %v", err)) + return + } + transport := &http.Transport{ + Proxy: http.ProxyURL(proxyURL), + } + client.Transport = transport + } + resp, err := client.Do(req) if err != nil { rtn <- makeAIError(fmt.Errorf("failed to send anthropic request: %v", err)) diff --git a/pkg/waveai/googlebackend.go b/pkg/waveai/googlebackend.go index 06daf76dcd..8c87259873 100644 --- a/pkg/waveai/googlebackend.go +++ b/pkg/waveai/googlebackend.go @@ -4,6 +4,8 @@ import ( "context" "fmt" "log" + "net/http" + "net/url" "github.com/google/generative-ai-go/genai" "github.com/wavetermdev/waveterm/pkg/wshrpc" @@ -16,7 +18,30 @@ type GoogleBackend struct{} var _ AIBackend = GoogleBackend{} func (GoogleBackend) StreamCompletion(ctx context.Context, request wshrpc.WaveAIStreamRequest) chan wshrpc.RespOrErrorUnion[wshrpc.WaveAIPacketType] { - client, err := genai.NewClient(ctx, option.WithAPIKey(request.Opts.APIToken)) + var clientOptions []option.ClientOption + clientOptions = append(clientOptions, option.WithAPIKey(request.Opts.APIToken)) + + // Configure proxy if specified + if request.Opts.ProxyURL != "" { + proxyURL, err := url.Parse(request.Opts.ProxyURL) + if err != nil { + rtn := make(chan wshrpc.RespOrErrorUnion[wshrpc.WaveAIPacketType]) + go func() { + defer close(rtn) + rtn <- makeAIError(fmt.Errorf("invalid proxy URL: %v", err)) + }() + return rtn + } + transport := &http.Transport{ + Proxy: http.ProxyURL(proxyURL), + } + httpClient := &http.Client{ + Transport: transport, + } + clientOptions = append(clientOptions, option.WithHTTPClient(httpClient)) + } + + client, err := genai.NewClient(ctx, clientOptions...) if err != nil { log.Printf("failed to create client: %v", err) return nil diff --git a/pkg/waveai/openaibackend.go b/pkg/waveai/openaibackend.go index 36135884a6..c077afeea4 100644 --- a/pkg/waveai/openaibackend.go +++ b/pkg/waveai/openaibackend.go @@ -8,6 +8,8 @@ import ( "errors" "fmt" "io" + "net/http" + "net/url" "regexp" "strings" @@ -100,6 +102,21 @@ func (OpenAIBackend) StreamCompletion(ctx context.Context, request wshrpc.WaveAI clientConfig.APIVersion = request.Opts.APIVersion } + // Configure proxy if specified + if request.Opts.ProxyURL != "" { + proxyURL, err := url.Parse(request.Opts.ProxyURL) + if err != nil { + rtn <- makeAIError(fmt.Errorf("invalid proxy URL: %v", err)) + return + } + transport := &http.Transport{ + Proxy: http.ProxyURL(proxyURL), + } + clientConfig.HTTPClient = &http.Client{ + Transport: transport, + } + } + client := openaiapi.NewClientWithConfig(clientConfig) req := openaiapi.ChatCompletionRequest{ Model: request.Opts.Model, diff --git a/pkg/waveai/perplexitybackend.go b/pkg/waveai/perplexitybackend.go index a3786cabd1..e24481d417 100644 --- a/pkg/waveai/perplexitybackend.go +++ b/pkg/waveai/perplexitybackend.go @@ -11,6 +11,7 @@ import ( "fmt" "io" "net/http" + "net/url" "strings" "github.com/wavetermdev/waveterm/pkg/panichandler" @@ -108,7 +109,20 @@ func (PerplexityBackend) StreamCompletion(ctx context.Context, request wshrpc.Wa req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer "+request.Opts.APIToken) + // Configure HTTP client with proxy if specified client := &http.Client{} + if request.Opts.ProxyURL != "" { + proxyURL, err := url.Parse(request.Opts.ProxyURL) + if err != nil { + rtn <- makeAIError(fmt.Errorf("invalid proxy URL: %v", err)) + return + } + transport := &http.Transport{ + Proxy: http.ProxyURL(proxyURL), + } + client.Transport = transport + } + resp, err := client.Do(req) if err != nil { rtn <- makeAIError(fmt.Errorf("failed to send perplexity request: %v", err)) diff --git a/pkg/wconfig/metaconsts.go b/pkg/wconfig/metaconsts.go index 0185b3bc24..1057b9c82f 100644 --- a/pkg/wconfig/metaconsts.go +++ b/pkg/wconfig/metaconsts.go @@ -22,6 +22,7 @@ const ( ConfigKey_AIApiVersion = "ai:apiversion" ConfigKey_AiMaxTokens = "ai:maxtokens" ConfigKey_AiTimeoutMs = "ai:timeoutms" + ConfigKey_AiProxyUrl = "ai:proxyurl" ConfigKey_AiFontSize = "ai:fontsize" ConfigKey_AiFixedFontSize = "ai:fixedfontsize" diff --git a/pkg/wconfig/settingsconfig.go b/pkg/wconfig/settingsconfig.go index 814d3d46a9..e926689abf 100644 --- a/pkg/wconfig/settingsconfig.go +++ b/pkg/wconfig/settingsconfig.go @@ -44,6 +44,7 @@ type AiSettingsType struct { AIApiVersion string `json:"ai:apiversion,omitempty"` AiMaxTokens float64 `json:"ai:maxtokens,omitempty"` AiTimeoutMs float64 `json:"ai:timeoutms,omitempty"` + AiProxyUrl string `json:"ai:proxyurl,omitempty"` AiFontSize float64 `json:"ai:fontsize,omitempty"` AiFixedFontSize float64 `json:"ai:fixedfontsize,omitempty"` DisplayName string `json:"display:name,omitempty"` @@ -67,6 +68,7 @@ type SettingsType struct { AIApiVersion string `json:"ai:apiversion,omitempty"` AiMaxTokens float64 `json:"ai:maxtokens,omitempty"` AiTimeoutMs float64 `json:"ai:timeoutms,omitempty"` + AiProxyUrl string `json:"ai:proxyurl,omitempty"` AiFontSize float64 `json:"ai:fontsize,omitempty"` AiFixedFontSize float64 `json:"ai:fixedfontsize,omitempty"` diff --git a/pkg/wshrpc/wshrpctypes.go b/pkg/wshrpc/wshrpctypes.go index 3d629533cf..0b984a468e 100644 --- a/pkg/wshrpc/wshrpctypes.go +++ b/pkg/wshrpc/wshrpctypes.go @@ -496,6 +496,7 @@ type WaveAIOptsType struct { OrgID string `json:"orgid,omitempty"` APIVersion string `json:"apiversion,omitempty"` BaseURL string `json:"baseurl,omitempty"` + ProxyURL string `json:"proxyurl,omitempty"` MaxTokens int `json:"maxtokens,omitempty"` MaxChoices int `json:"maxchoices,omitempty"` TimeoutMs int `json:"timeoutms,omitempty"` diff --git a/schema/aipresets.json b/schema/aipresets.json index db6d2b052e..c932a5c777 100644 --- a/schema/aipresets.json +++ b/schema/aipresets.json @@ -36,6 +36,9 @@ "ai:timeoutms": { "type": "number" }, + "ai:proxyurl": { + "type": "string" + }, "ai:fontsize": { "type": "number" }, diff --git a/schema/settings.json b/schema/settings.json index 395974b573..c885204a09 100644 --- a/schema/settings.json +++ b/schema/settings.json @@ -50,6 +50,9 @@ "ai:timeoutms": { "type": "number" }, + "ai:proxyurl": { + "type": "string" + }, "ai:fontsize": { "type": "number" },