Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 | 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | import { qwenCodeModels } from "@shared/api"
import { Mode } from "@shared/storage/types"
import { VSCodeLink, VSCodeTextField } from "@vscode/webview-ui-toolkit/react"
import { useExtensionState } from "@/context/ExtensionStateContext"
import { ModelInfoView } from "../common/ModelInfoView"
import { ModelSelector } from "../common/ModelSelector"
import { normalizeApiConfiguration } from "../utils/providerUtils"
import { useApiConfigurationHandlers } from "../utils/useApiConfigurationHandlers"
/**
* Props for the QwenCodeProvider component
*/
interface QwenCodeProviderProps {
showModelOptions: boolean
isPopup?: boolean
currentMode: Mode
}
/**
* The Qwen Code provider configuration component
*/
export const QwenCodeProvider = ({ showModelOptions, isPopup, currentMode }: QwenCodeProviderProps) => {
const { apiConfiguration } = useExtensionState()
const { handleFieldChange } = useApiConfigurationHandlers()
// Get the normalized configuration
const { selectedModelId, selectedModelInfo } = normalizeApiConfiguration(apiConfiguration, currentMode)
return (
<div>
<h3 style={{ color: "var(--vscode-foreground)", margin: "8px 0" }}>Qwen Code API Configuration</h3>
<VSCodeTextField
onInput={(e: any) => handleFieldChange("qwenCodeOauthPath", e.target.value)}
placeholder="~/.qwen/oauth_creds.json"
style={{ width: "100%" }}
value={apiConfiguration?.qwenCodeOauthPath || ""}>
OAuth Credentials Path
</VSCodeTextField>
<div style={{ fontSize: "12px", color: "var(--vscode-descriptionForeground)", marginTop: "4px" }}>
Path to your Qwen OAuth credentials file. Use ~/.qwen/oauth_creds.json or provide a custom path.
</div>
<div style={{ fontSize: "12px", color: "var(--vscode-descriptionForeground)", marginTop: "12px" }}>
Qwen Code is an OAuth-based API that requires authentication through the official Qwen client. You'll need to set
up OAuth credentials first.
</div>
<div style={{ fontSize: "12px", color: "var(--vscode-descriptionForeground)", marginTop: "8px" }}>
To get started:
<br />
1. Install the official Qwen client
<br />
2. Authenticate using your account
<br />
3. OAuth credentials will be stored automatically
</div>
<VSCodeLink
href="https://github.com/QwenLM/qwen-code/blob/main/README.md"
style={{
color: "var(--vscode-textLink-foreground)",
marginTop: "8px",
display: "inline-block",
fontSize: "12px",
}}>
Setup Instructions
</VSCodeLink>
{showModelOptions && (
<>
<ModelSelector
label="Model"
models={qwenCodeModels}
onChange={(modelId) => {
const fieldName = currentMode === "plan" ? "planModeApiModelId" : "actModeApiModelId"
handleFieldChange(fieldName, modelId)
}}
selectedModelId={selectedModelId}
/>
<ModelInfoView isPopup={isPopup} modelInfo={selectedModelInfo} selectedModelId={selectedModelId} />
</>
)}
</div>
)
}
|