Commit Graph

18 Commits

Author SHA1 Message Date
Md Rakibul Islam Rocky
29d8421ce9 Enhance Azure configuration handling and UI updates (#1289)
# Changes 

- Update Azure configuration components to manage API key and resource
name settings.
- Improve visibility of conThis pull request introduces a redesigned
Azure provider settings UI and refactors the logic for configuring Azure
OpenAI credentials, both in the frontend and supporting hooks. The main
changes focus on making the Azure configuration experience clearer and
more robust by supporting both environment variable and saved settings,
improving status indicators, and updating the logic for determining
provider readiness.

**Azure Provider UI and Logic Improvements**

* Added a new `AzureConfiguration` component that provides a dedicated
form for entering and saving Azure resource name and API key, with clear
status indicators and error handling. The UI now explains precedence
between saved settings and environment variables, and guides users
through configuration.
(`src/components/settings/AzureConfiguration.tsx`)
* Updated the main provider settings page and API key configuration
logic to pass Azure-specific settings and update functions to the new
component, ensuring seamless integration and correct state management.
(`src/components/settings/ApiKeyConfiguration.tsx`,
`src/components/settings/ProviderSettingsPage.tsx`)
[[1]](diffhunk://#diff-2104fb487cda3768cc5777889100e882f51e7fb3e13abe3cc89cf8ed1444300aR35)
[[2]](diffhunk://#diff-2104fb487cda3768cc5777889100e882f51e7fb3e13abe3cc89cf8ed1444300aR51-R61)
[[3]](diffhunk://#diff-9140e707ebb56ffed3272b4661ea1e6d8388ee604a8535c58e8a1564d280057cR297)
* Refactored the logic for determining whether Azure is configured to
check both saved settings and environment variables, ensuring accurate
status display and enabling fallback to environment variables if no
settings are saved. (`src/components/settings/ProviderSettingsPage.tsx`,
`src/hooks/useLanguageModelProviders.ts`)
[[1]](diffhunk://#diff-9140e707ebb56ffed3272b4661ea1e6d8388ee604a8535c58e8a1564d280057cL72-R99)
[[2]](diffhunk://#diff-9ac9e279a0cda34a0bc519348d5474b2e355b0828a678495be3af1e8984b5be5R35-R48)
* Updated the Azure provider E2E test to verify the new UI elements,
status indicators, and guidance, ensuring the test matches the new
configuration flow and messaging.
(`e2e-tests/azure_provider_settings.spec.ts`)

**Supporting Type and Import Updates**

* Added and updated type imports for `AzureProviderSetting` and
`VertexProviderSetting` where needed to support the new logic and UI.
(`src/components/settings/ProviderSettingsPage.tsx`,
`src/hooks/useLanguageModelProviders.ts`,
`src/ipc/utils/get_model_client.ts`)
[[1]](diffhunk://#diff-9140e707ebb56ffed3272b4661ea1e6d8388ee604a8535c58e8a1564d280057cL14-R14)
[[2]](diffhunk://#diff-9ac9e279a0cda34a0bc519348d5474b2e355b0828a678495be3af1e8984b5be5L5-R5)
[[3]](diffhunk://#diff-3cd526c6c10413c1387bfef450e48b880ba6f54865e96046044586ff4192bcceR15)
* Changed Azure model client import to use `createAzure` for consistency
and future extensibility. (`src/ipc/utils/get_model_client.ts`)
[Copilot is generating a summary...]figuration status and error handling
in the UI.
- Refactor environment variable checks to prioritize saved settings.
- Add support for Azure provider settings in the schema.
- Modify tests to reflect changes in Azure configuration requirements.

# Changes in short

- **Azure settings panel**
  - Replaced with a full form that:
    - Persists API key and resource name  
    - Surfaces save state  
    - Keeps the environment-variable helper  
  - *(src/components/settings/AzureConfiguration.tsx:23-214)*

- **Settings stack workflow**
  - Threaded the new Azure workflow:
    - Config shim now passes `updateSettings`  
    - Provider status checks prefer saved Azure values before env vars  
- *(src/components/settings/ApiKeyConfiguration.tsx:40-55,
src/components/settings/ProviderSettingsPage.tsx:60-105)*

- **Provider detection**
  - Azure treated like other saved credentials by:
    - Looking for both stored fields, or  
    - The pair of env vars  
  - *(src/hooks/useLanguageModelProviders.ts:5-57)*

- **Back-end model creation**
  - Reads saved Azure credentials (falling back to env vars)  
  - Builds the client via `createAzure`  
  - *(src/ipc/utils/get_model_client.ts:316-369)*

- **Provider schema support**
  - Extended so Azure can store its resource name alongside the secret  
  - *(src/lib/schemas.ts:82-109)*  

- **E2E tests**
  - Updated Azure Playwright spec to cover the new UI  
  - *(e2e-tests/azure_provider_settings.spec.ts:4-50)*

Issues resolved: #1275
2025-09-30 13:53:52 -07:00
Will Chen
6d3c397d40 Add MCP support (#1028) 2025-09-19 15:43:39 -07:00
Will Chen
72acb31d59 More free models (#1244)
<!-- This is an auto-generated description by cubic. -->

## Summary by cubic
Adds support for free OpenRouter models and a new “Free (OpenRouter)”
auto option that fails over across free models for reliability. Improves
setup flow and UI with provider cards, a “Free” price badge, and an
OpenRouter setup prompt in chat.

- **New Features**
- Added OpenRouter free models: Qwen3 Coder (free), DeepSeek v3 (free),
DeepSeek v3.1 (free), marked with dollarSigns=0 and a “Free” badge.
- New auto model: “Free (OpenRouter)” that uses a fallback client to
cycle through free models with smart retry on transient errors.
- New SetupProviderCard component and updated SetupBanner with dedicated
Google and OpenRouter setup cards.
- Chat shows an OpenRouter setup prompt when “Free (OpenRouter)” is
selected and OpenRouter isn’t configured.
- New PriceBadge component in ModelPicker to display “Free” or price
tier.
- E2E: added setup flow test and option to show the setup screen in
tests.
- Model updates: added DeepSeek v3.1, updated Kimi K2 to kimi-k2-0905,
migrated providers to LanguageModelV2.

<!-- End of auto-generated description by cubic. -->
2025-09-10 14:20:17 -07:00
Md Rakibul Islam Rocky
4db6d63b72 Add Google Vertex AI provider (#1163)
# Summary

* Adds first-class **Google Vertex AI provider** using
`@ai-sdk/google-vertex`.
* Supports **Gemini 2.5** models and partner **MaaS (Model Garden)**
models via full publisher IDs.
* New **Vertex-specific settings UI** for Project, Location, and Service
Account JSON.
* Implements a **“thinking” toggle** for Gemini 2.5 Flash

  * Pro: always on
  * Flash: toggleable
  * Flash Lite: none
* Fixes *“AI not found”* for Vertex built-ins by mapping to
`publishers/google` paths.
* Hardens **cross-platform file ops** and ensures all tests pass.

---

# What’s New

### Vertex AI Provider

* Uses `@ai-sdk/google-vertex` with `googleAuthOptions.credentials` from
pasted Service Account JSON.
* Configurable **project** and **location**.
* Base URL → `/projects/{project}/locations/{location}`

  * Built-ins: `publishers/google/models/<id>`
  * Partner MaaS: `publishers/<partner>/models/...`

### Built-in Vertex Models

* `gemini-2.5-pro`
* `gemini-2.5-flash`
* `gemini-2.5-flash-lite`

### Thinking Behavior

* Vertex + Google marked as thinking-capable.
* Pro: always thinking
* Flash: toggle in UI
* Flash Lite: none

### Vertex Settings UI

* New **Google Vertex AI panel** for Project ID, Location, Service
Account JSON.
* Keys encrypted like other secrets.

---

# Fixes

* **Model resolution:** built-ins auto-map to
`publishers/google/models/<id>`.
* **Partner MaaS support:** full publisher IDs work directly (e.g.
DeepSeek).
* **Cross-platform paths:** normalize file ops with `toPosixPath`,
preserve `safeJoin` semantics.

---

# Why This Is Better

* Users can select **Vertex alongside other providers**.
* **More models** available through Model Garden.
* **Dedicated setup UI** reduces misconfig.
* **Thinking toggle** gives control over cost vs. reasoning depth.

---

# Files Changed

* **Provider & Models**: `language_model_helpers.ts`,
`get_model_client.ts`
* **Streaming**: `chat_stream_handlers.ts`
* **Schemas & Encryption**: `schemas.ts`, `settings.ts`
* **Settings UI**: `VertexConfiguration.tsx`, `ApiKeyConfiguration.tsx`
* **Models UI**: `ModelsSection.tsx` (Flash toggle)
* **Setup Detection**: `useLanguageModelProviders.ts`
* **Path Utils**: `path_utils.ts`, `response_processor.ts`
* **Deps**: `package.json` → `@ai-sdk/google-vertex@3.0.16`

---

# Tests & Validation

* **TypeScript**: `npm run ts` → 
* **Lint**: `npm run lint` → 
* **Unit tests**: `npm test` →  231 passed, 0 failed

---

# Migration / Notes

* No breaking changes.
* For Vertex usage:

  * Ensure Vertex AI API is enabled.
  * Service Account needs `roles/aiplatform.user`.
  * Region must support model (e.g. `us-central1`).
* Thinking toggle currently affects **only** Gemini 2.5 Flash.

---

# Manual QA

1. Configure Vertex with Project/Location/Service Account JSON.
2. Test built-ins:

   * `gemini-2.5-pro`
   * `gemini-2.5-flash` (toggle on/off)
   * `gemini-2.5-flash-lite`
3. Test MaaS partner model (e.g., DeepSeek) via full publisher ID.
4. Verify other providers remain unaffected.
    
<!-- This is an auto-generated description by cubic. -->
---

## Summary by cubic
Adds a first-class Google Vertex AI provider with Gemini 2.5 models, a
Vertex settings panel, and a “thinking” toggle for Gemini 2.5 Flash.
Also fixes model resolution for Vertex and hardens cross-platform file
operations.

- **New Features**
- Vertex AI provider via @ai-sdk/google-vertex with project, location,
and service account JSON.
- Built-in models: gemini-2.5-pro, gemini-2.5-flash,
gemini-2.5-flash-lite.
- “Thinking” support: Pro always on; Flash toggle in Models UI; Flash
Lite none.
- MaaS partners supported via full publisher paths (e.g.,
publishers/<partner>/models/...).
  - Vertex settings UI with encrypted service account key storage.

- **Bug Fixes**
  - Built-in Vertex models auto-map to publishers/google/models/<id>.
  - Consistent file ops across platforms using toPosixPath.
- Vertex readiness detection requires project/location/service account
JSON.
- Streaming “thinking” behavior respects Vertex Flash toggle and Pro
always-on.

<!-- End of auto-generated description by cubic. -->

---------

Co-authored-by: Md Rakibul Islam Rocky <mdrirocky08@gmail.com>
Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Will Chen <willchen90@gmail.com>
2025-09-08 22:41:12 -07:00
Tanner-Maasen
2ffbbbca8f Add Azure OpenAI Custom Model Integration (#1001)
Fixes #710 

This PR implements comprehensive Azure OpenAI integration for Dyad,
enabling users to leverage Azure
OpenAI models through proper environment variable configuration. The
implementation adds Azure as a
supported provider with full integration into the existing language
model architecture, including support
  for GPT-5 models. Key features include environment-based
configuration using `AZURE_API_KEY` and `AZURE_RESOURCE_NAME`,
specialized UI components that provide clear
setup instructions and status indicators, and seamless integration with
Dyad's existing provider system.
The Azure provider leverages the @ai-sdk/azure package (v1.3.25) for
compatibility with the current
  TypeScript language model interfaces.

The implementation includes robust error handling for missing
configuration, comprehensive test coverage
with 9 new unit tests covering critical functionality like model client
creation and error scenarios, and
  an E2E test for the Azure-specific settings UI. 

<img width="1510" height="908" alt="Screenshot 2025-08-18 at 9 14 32 PM"
src="https://github.com/user-attachments/assets/04aa99e1-1590-4bb0-86c9-a67b97bc7500"
/>

---------

Co-authored-by: graphite-app[bot] <96075541+graphite-app[bot]@users.noreply.github.com>
Co-authored-by: Will Chen <willchen90@gmail.com>
2025-08-30 20:47:25 -07:00
BlueRaw
2c208e3ace add editable custom model (#794)
Now users can free to edit their custom models by double clicking any
custom models created in each provider.
Before this, they have to delete -> create a new one.
I simply add an edit panel (which looks the same as 'Add Custom Model')
and integrate that process into the "update" button.

There is one more issue that if a user deletes a model that he was using
in chat, then back to chat, that model would still appear (and work)
unless user chooses a new one.
Tried to modify "delete-custom-model" in language_model_handlers.ts by
the logic that if the name of that model matches the latest using one ->
switch to auto (or default) model. Yet I failed, maybe need more
explanation for this :)
2025-08-12 21:53:44 -07:00
Will Chen
4661012390 Do not allow custom models for (dyad/auto) & drive-by: key improvement (#156) 2025-05-13 15:42:01 -07:00
Will Chen
ea9301c771 Support delete custom model (#136) 2025-05-12 16:37:39 -07:00
Will Chen
e115074937 Fix DB schema (#135) 2025-05-12 16:12:36 -07:00
Will Chen
477015b43d allow creating and listing custom language model (#134) 2025-05-12 16:00:16 -07:00
Will Chen
cd7eaa8ece Prep for custom models: support reading custom providers (#131) 2025-05-12 14:52:48 -07:00
Will Chen
2537fbb342 lint using oxlint (#106) 2025-05-08 17:21:35 -07:00
Will Chen
0d56651220 Run prettier on everything (#104) 2025-05-06 23:02:28 -07:00
Will Chen
4848b2f085 Add toggle for disabling Dyad Pro (#24)
* Add toggle for disabling Dyad Pro
* Entering key for Dyad pro enables dyad pro
2025-04-26 10:13:35 -07:00
Will Chen
2ad10ba039 Support LLM gateway with Dyad API key (#23)
* Do not make API key input (password) - hurts usability
* Support LLM gateway (and add GPT 4.1 mini model)
* Show Dyad Pro button
* Fix to use auto (not dyad) for detecting dyad pro
* Fix description of gpt 4.1-mini
2025-04-26 08:52:08 -07:00
Will Chen
0e48d02a0b Polish UX for Settings pages; add Go Back button to setting page 2025-04-21 14:42:35 -07:00
Will Chen
658d4e0bde proper secret encrpytion 2025-04-14 23:15:58 -07:00
Will Chen
43f67e0739 Initial open-source release 2025-04-11 09:38:16 -07:00