mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 04:11:10 -05:00
New users default to OpenRouter
This commit is contained in:
@@ -425,7 +425,7 @@ export class ClaudeDevProvider implements vscode.WebviewViewProvider {
|
|||||||
|
|
||||||
async getState() {
|
async getState() {
|
||||||
const [
|
const [
|
||||||
apiProvider,
|
storedApiProvider,
|
||||||
apiModelId,
|
apiModelId,
|
||||||
apiKey,
|
apiKey,
|
||||||
openRouterApiKey,
|
openRouterApiKey,
|
||||||
@@ -447,9 +447,24 @@ export class ClaudeDevProvider implements vscode.WebviewViewProvider {
|
|||||||
this.getGlobalState("lastShownAnnouncementId") as Promise<string | undefined>,
|
this.getGlobalState("lastShownAnnouncementId") as Promise<string | undefined>,
|
||||||
this.getGlobalState("customInstructions") as Promise<string | undefined>,
|
this.getGlobalState("customInstructions") as Promise<string | undefined>,
|
||||||
])
|
])
|
||||||
|
|
||||||
|
let apiProvider: ApiProvider
|
||||||
|
if (storedApiProvider) {
|
||||||
|
apiProvider = storedApiProvider
|
||||||
|
} else {
|
||||||
|
// Either new user or legacy user that doesn't have the apiProvider stored in state
|
||||||
|
// (If they're using OpenRouter or Bedrock, then apiProvider state will exist)
|
||||||
|
if (apiKey) {
|
||||||
|
apiProvider = "anthropic"
|
||||||
|
} else {
|
||||||
|
// New users should default to openrouter
|
||||||
|
apiProvider = "openrouter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
apiConfiguration: {
|
apiConfiguration: {
|
||||||
apiProvider: apiProvider || "anthropic", // for legacy users that were using Anthropic by default
|
apiProvider,
|
||||||
apiModelId,
|
apiModelId,
|
||||||
apiKey,
|
apiKey,
|
||||||
openRouterApiKey,
|
openRouterApiKey,
|
||||||
|
|||||||
@@ -1,10 +1,9 @@
|
|||||||
import { ApiConfiguration } from "../../../src/shared/api"
|
|
||||||
import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
|
import { VSCodeButton, VSCodeLink } from "@vscode/webview-ui-toolkit/react"
|
||||||
import React, { useEffect, useState } from "react"
|
import React, { useEffect, useState } from "react"
|
||||||
|
import { ApiConfiguration } from "../../../src/shared/api"
|
||||||
import { validateApiConfiguration } from "../utils/validate"
|
import { validateApiConfiguration } from "../utils/validate"
|
||||||
import { vscode } from "../utils/vscode"
|
import { vscode } from "../utils/vscode"
|
||||||
import ApiOptions from "./ApiOptions"
|
import ApiOptions from "./ApiOptions"
|
||||||
import { useEffectOnce } from "react-use"
|
|
||||||
|
|
||||||
interface WelcomeViewProps {
|
interface WelcomeViewProps {
|
||||||
apiConfiguration?: ApiConfiguration
|
apiConfiguration?: ApiConfiguration
|
||||||
@@ -24,13 +23,6 @@ const WelcomeView: React.FC<WelcomeViewProps> = ({ apiConfiguration, setApiConfi
|
|||||||
setApiErrorMessage(validateApiConfiguration(apiConfiguration))
|
setApiErrorMessage(validateApiConfiguration(apiConfiguration))
|
||||||
}, [apiConfiguration])
|
}, [apiConfiguration])
|
||||||
|
|
||||||
useEffectOnce(() => {
|
|
||||||
setApiConfiguration((prevConfig) => ({
|
|
||||||
...prevConfig,
|
|
||||||
apiProvider: "openrouter",
|
|
||||||
}))
|
|
||||||
})
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div style={{ position: "fixed", top: 0, left: 0, right: 0, bottom: 0, padding: "0 20px" }}>
|
<div style={{ position: "fixed", top: 0, left: 0, right: 0, bottom: 0, padding: "0 20px" }}>
|
||||||
<h2>Hi, I'm Claude Dev</h2>
|
<h2>Hi, I'm Claude Dev</h2>
|
||||||
|
|||||||
Reference in New Issue
Block a user