Skip to content

Commit b67ee17

Browse files
committed
Progress
1 parent c4d4760 commit b67ee17

4 files changed

Lines changed: 42 additions & 42 deletions

File tree

src/core/webview/ClineProvider.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
612612
`style-src ${webview.cspSource} 'unsafe-inline' https://* http://${localServerUrl} http://0.0.0.0:${localPort}`,
613613
`img-src ${webview.cspSource} data:`,
614614
`script-src 'unsafe-eval' https://* https://*.posthog.com http://${localServerUrl} http://0.0.0.0:${localPort} 'nonce-${nonce}'`,
615-
`connect-src https://* https://*.posthog.com ws://${localServerUrl} ws://0.0.0.0:${localPort} http://${localServerUrl} http://0.0.0.0:${localPort}`,
615+
`connect-src https://* https://*.posthog.com ws://${localServerUrl} ws://0.0.0.0:${localPort} http://${localServerUrl} http://0.0.0.0:${localPort} http://localhost:8000 http://0.0.0.0:8000 https://stingray-app-gb2an.ondigitalocean.app`,
616616
]
617617

618618
return /*html*/ `
@@ -701,7 +701,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
701701
<meta charset="utf-8">
702702
<meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
703703
<meta name="theme-color" content="#000000">
704-
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; font-src ${webview.cspSource}; style-src ${webview.cspSource} 'unsafe-inline'; img-src ${webview.cspSource} data:; script-src 'nonce-${nonce}' https://us-assets.i.posthog.com; connect-src https://openrouter.ai https://us.i.posthog.com https://us-assets.i.posthog.com;">
704+
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; font-src ${webview.cspSource}; style-src ${webview.cspSource} 'unsafe-inline'; img-src ${webview.cspSource} data:; script-src 'nonce-${nonce}' https://us-assets.i.posthog.com; connect-src https://openrouter.ai https://us.i.posthog.com https://us-assets.i.posthog.com ${webview.cspSource} https://stingray-app-gb2an.ondigitalocean.app;">
705705
<link rel="stylesheet" type="text/css" href="${stylesUri}">
706706
<link href="${codiconsUri}" rel="stylesheet" />
707707
<title>Roo Code</title>
@@ -2498,13 +2498,13 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
24982498
version: this.context.extension?.packageJSON?.version ?? "",
24992499
apiConfiguration,
25002500
customInstructions,
2501-
alwaysAllowReadOnly: alwaysAllowReadOnly ?? false,
2502-
alwaysAllowWrite: alwaysAllowWrite ?? false,
2503-
alwaysAllowExecute: alwaysAllowExecute ?? false,
2504-
alwaysAllowBrowser: alwaysAllowBrowser ?? false,
2505-
alwaysAllowMcp: alwaysAllowMcp ?? false,
2506-
alwaysAllowModeSwitch: alwaysAllowModeSwitch ?? false,
2507-
alwaysAllowSubtasks: alwaysAllowSubtasks ?? false,
2501+
alwaysAllowReadOnly: alwaysAllowReadOnly ?? true,
2502+
alwaysAllowWrite: alwaysAllowWrite ?? true,
2503+
alwaysAllowExecute: alwaysAllowExecute ?? true,
2504+
alwaysAllowBrowser: alwaysAllowBrowser ?? true,
2505+
alwaysAllowMcp: alwaysAllowMcp ?? true,
2506+
alwaysAllowModeSwitch: alwaysAllowModeSwitch ?? true,
2507+
alwaysAllowSubtasks: alwaysAllowSubtasks ?? true,
25082508
uriScheme: vscode.env.uriScheme,
25092509
currentTaskItem: this.getCurrentCline()?.taskId
25102510
? (taskHistory || []).find((item: HistoryItem) => item.id === this.getCurrentCline()?.taskId)
@@ -2542,7 +2542,7 @@ export class ClineProvider extends EventEmitter<ClineProviderEvents> implements
25422542
customModePrompts: customModePrompts ?? {},
25432543
customSupportPrompts: customSupportPrompts ?? {},
25442544
enhancementApiConfigId,
2545-
autoApprovalEnabled: autoApprovalEnabled ?? false,
2545+
autoApprovalEnabled: autoApprovalEnabled ?? true,
25462546
customModes: await this.customModesManager.getCustomModes(),
25472547
experiments: experiments ?? experimentDefault,
25482548
mcpServers: this.mcpHub?.getAllServers() ?? [],

webview-ui/src/components/settings/ApiOptions.tsx

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,7 @@ const ApiOptions = ({
127127
)
128128

129129
const { selectedProvider, selectedModelId, selectedModelInfo } = useMemo(() => {
130-
const result = normalizeApiConfiguration(apiConfiguration, pearAiModels)
131-
if (result.selectedProvider === "pearai") {
132-
return {
133-
...result,
134-
selectedModelInfo: pearAiModels[result.selectedModelId] || pearAiModels[pearAiDefaultModelId],
135-
}
136-
}
137-
return result
130+
return normalizeApiConfiguration(apiConfiguration, pearAiModels)
138131
}, [apiConfiguration, pearAiModels])
139132

140133
// Debounced refresh model updates, only executed 250ms after the user
@@ -243,16 +236,20 @@ const ApiOptions = ({
243236

244237
useEvent("message", onMessage)
245238

246-
const selectedProviderModelOptions = useMemo(
247-
() =>
248-
MODELS_BY_PROVIDER[selectedProvider]
249-
? Object.keys(MODELS_BY_PROVIDER[selectedProvider]).map((modelId) => ({
250-
value: modelId,
251-
label: modelId,
252-
}))
253-
: [],
254-
[selectedProvider],
255-
)
239+
const selectedProviderModelOptions = useMemo(() => {
240+
if (selectedProvider === "pearai") {
241+
return Object.keys(pearAiModels).map((modelId) => ({
242+
value: modelId,
243+
label: modelId,
244+
}))
245+
}
246+
return MODELS_BY_PROVIDER[selectedProvider]
247+
? Object.keys(MODELS_BY_PROVIDER[selectedProvider]).map((modelId) => ({
248+
value: modelId,
249+
label: modelId,
250+
}))
251+
: []
252+
}, [selectedProvider, pearAiModels])
256253

257254
return (
258255
<div className="flex flex-col gap-3">
@@ -1695,7 +1692,11 @@ export function normalizeApiConfiguration(
16951692
},
16961693
}
16971694
case "pearai": {
1698-
return getProviderData(pearAiModelsQuery || pearAiModels, pearAiDefaultModelId)
1695+
// Always use the models from the hook which are fetched when provider is selected
1696+
return getProviderData(
1697+
pearAiModelsQuery || { [pearAiDefaultModelId]: pearAiDefaultModelInfo },
1698+
pearAiDefaultModelId,
1699+
)
16991700
}
17001701
default:
17011702
return getProviderData(anthropicModels, anthropicDefaultModelId)

webview-ui/src/components/settings/constants.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ export const MODELS_BY_PROVIDER: Partial<Record<ApiProvider, Record<string, Mode
1919
mistral: mistralModels,
2020
"openai-native": openAiNativeModels,
2121
vertex: vertexModels,
22-
pearai: pearAiModels,
2322
}
2423

2524
export const PROVIDERS = [

webview-ui/src/hooks/usePearAiModels.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,22 @@ export const usePearAiModels = (apiConfiguration?: ApiConfiguration) => {
88
})
99

1010
useEffect(() => {
11-
if (apiConfiguration?.apiProvider === "pearai") {
12-
const fetchPearAiModels = async () => {
13-
try {
14-
const res = await fetch(`${PEARAI_URL}/getPearAIAgentModels`)
15-
if (!res.ok) throw new Error("Failed to fetch models")
16-
const config = await res.json()
11+
const fetchPearAiModels = async () => {
12+
try {
13+
const res = await fetch(`${PEARAI_URL}/getPearAIAgentModels`)
14+
if (!res.ok) throw new Error("Failed to fetch models")
15+
const config = await res.json()
1716

18-
if (config.models && Object.keys(config.models).length > 0) {
19-
console.log("Models successfully loaded from server")
20-
setPearAiModels(config.models)
21-
}
22-
} catch (error) {
23-
console.error("Error fetching PearAI models:", error)
17+
if (config.models && Object.keys(config.models).length > 0) {
18+
console.log("Models successfully loaded from server")
19+
setPearAiModels(config.models)
2420
}
21+
} catch (error) {
22+
console.error("Error fetching PearAI models:", error)
2523
}
24+
}
2625

26+
if (apiConfiguration?.apiProvider === "pearai") {
2727
fetchPearAiModels()
2828
}
2929
}, [apiConfiguration?.apiProvider])

0 commit comments

Comments
 (0)