|
@@ -1,11 +1,6 @@
|
|
|
-import {
|
|
|
|
|
- VSCodeButton,
|
|
|
|
|
- VSCodeDropdown,
|
|
|
|
|
- VSCodeLink,
|
|
|
|
|
- VSCodeOption,
|
|
|
|
|
- VSCodeTextField,
|
|
|
|
|
-} from "@vscode/webview-ui-toolkit/react"
|
|
|
|
|
|
|
+import { VSCodeDropdown, VSCodeLink, VSCodeOption, VSCodeTextField } from "@vscode/webview-ui-toolkit/react"
|
|
|
import React, { useCallback, useEffect, useMemo, useState } from "react"
|
|
import React, { useCallback, useEffect, useMemo, useState } from "react"
|
|
|
|
|
+import { useEvent } from "react-use"
|
|
|
import {
|
|
import {
|
|
|
ApiConfiguration,
|
|
ApiConfiguration,
|
|
|
ApiModelId,
|
|
ApiModelId,
|
|
@@ -19,9 +14,10 @@ import {
|
|
|
openRouterDefaultModelId,
|
|
openRouterDefaultModelId,
|
|
|
openRouterModels,
|
|
openRouterModels,
|
|
|
} from "../../../src/shared/api"
|
|
} from "../../../src/shared/api"
|
|
|
-import { vscode } from "../utils/vscode"
|
|
|
|
|
-import { useEvent } from "react-use"
|
|
|
|
|
import { ExtensionMessage } from "../../../src/shared/ExtensionMessage"
|
|
import { ExtensionMessage } from "../../../src/shared/ExtensionMessage"
|
|
|
|
|
+import { getKoduAddCreditsUrl, getKoduSignInUrl } from "../../../src/shared/kodu"
|
|
|
|
|
+import { vscode } from "../utils/vscode"
|
|
|
|
|
+import VSCodeButtonLink from "./VSCodeButtonLink"
|
|
|
|
|
|
|
|
interface ApiOptionsProps {
|
|
interface ApiOptionsProps {
|
|
|
showModelOptions: boolean
|
|
showModelOptions: boolean
|
|
@@ -29,6 +25,7 @@ interface ApiOptionsProps {
|
|
|
setApiConfiguration: React.Dispatch<React.SetStateAction<ApiConfiguration | undefined>>
|
|
setApiConfiguration: React.Dispatch<React.SetStateAction<ApiConfiguration | undefined>>
|
|
|
koduCredits?: number
|
|
koduCredits?: number
|
|
|
apiErrorMessage?: string
|
|
apiErrorMessage?: string
|
|
|
|
|
+ vscodeUriScheme?: string
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const ApiOptions: React.FC<ApiOptionsProps> = ({
|
|
const ApiOptions: React.FC<ApiOptionsProps> = ({
|
|
@@ -37,6 +34,7 @@ const ApiOptions: React.FC<ApiOptionsProps> = ({
|
|
|
setApiConfiguration,
|
|
setApiConfiguration,
|
|
|
koduCredits,
|
|
koduCredits,
|
|
|
apiErrorMessage,
|
|
apiErrorMessage,
|
|
|
|
|
+ vscodeUriScheme,
|
|
|
}) => {
|
|
}) => {
|
|
|
const [didFetchKoduCredits, setDidFetchKoduCredits] = useState(false)
|
|
const [didFetchKoduCredits, setDidFetchKoduCredits] = useState(false)
|
|
|
const handleInputChange = (field: keyof ApiConfiguration) => (event: any) => {
|
|
const handleInputChange = (field: keyof ApiConfiguration) => (event: any) => {
|
|
@@ -184,22 +182,19 @@ const ApiOptions: React.FC<ApiOptionsProps> = ({
|
|
|
{formatPrice(koduCredits || 0)}
|
|
{formatPrice(koduCredits || 0)}
|
|
|
</span>
|
|
</span>
|
|
|
</div>
|
|
</div>
|
|
|
- <VSCodeButton
|
|
|
|
|
- appearance="primary"
|
|
|
|
|
- onClick={() => vscode.postMessage({ type: "didClickKoduAddCredits" })}
|
|
|
|
|
|
|
+ <VSCodeButtonLink
|
|
|
|
|
+ href={getKoduAddCreditsUrl(vscodeUriScheme)}
|
|
|
style={{
|
|
style={{
|
|
|
width: "fit-content",
|
|
width: "fit-content",
|
|
|
}}>
|
|
}}>
|
|
|
Add Credits
|
|
Add Credits
|
|
|
- </VSCodeButton>
|
|
|
|
|
|
|
+ </VSCodeButtonLink>
|
|
|
</>
|
|
</>
|
|
|
) : (
|
|
) : (
|
|
|
<div style={{ margin: "4px 0px" }}>
|
|
<div style={{ margin: "4px 0px" }}>
|
|
|
- <VSCodeButton
|
|
|
|
|
- appearance="primary"
|
|
|
|
|
- onClick={() => vscode.postMessage({ type: "didClickKoduSignIn" })}>
|
|
|
|
|
|
|
+ <VSCodeButtonLink href={getKoduSignInUrl(vscodeUriScheme)}>
|
|
|
Sign in to Kodu
|
|
Sign in to Kodu
|
|
|
- </VSCodeButton>
|
|
|
|
|
|
|
+ </VSCodeButtonLink>
|
|
|
</div>
|
|
</div>
|
|
|
)}
|
|
)}
|
|
|
<p
|
|
<p
|
|
@@ -210,7 +205,7 @@ const ApiOptions: React.FC<ApiOptionsProps> = ({
|
|
|
}}>
|
|
}}>
|
|
|
Kodu is recommended for its high rate limits and access to the latest features like prompt
|
|
Kodu is recommended for its high rate limits and access to the latest features like prompt
|
|
|
caching.
|
|
caching.
|
|
|
- <VSCodeLink href="https://claude-dev.com" style={{ display: "inline", fontSize: "12px" }}>
|
|
|
|
|
|
|
+ <VSCodeLink href="https://kodu.ai" style={{ display: "inline", fontSize: "12px" }}>
|
|
|
Learn more about Kodu here.
|
|
Learn more about Kodu here.
|
|
|
</VSCodeLink>
|
|
</VSCodeLink>
|
|
|
</p>
|
|
</p>
|