Skip to content

Commit

Permalink
fix promptfiddle (#1201)
Browse files Browse the repository at this point in the history
<!-- ELLIPSIS_HIDDEN -->



> [!IMPORTANT]
> Enable playground proxy by default and handle NextJS environment in
`envVarsAtom` in `EventListener.tsx`.
> 
>   - **Behavior**:
> - Change `enablePlaygroundProxy` default to `true` in
`vscodeSettingsAtom` in `EventListener.tsx`.
> - In `envVarsAtom`, handle NextJS environment by always enabling proxy
and logging `vscodeSettings`.
>   - **Misc**:
> - Add logging for `vscodeSettings` in `envVarsAtom` in
`EventListener.tsx`.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis"
src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup>
for b475518. It will automatically
update as commits are pushed.</sup>

<!-- ELLIPSIS_HIDDEN -->
  • Loading branch information
aaronvg authored Nov 27, 2024
1 parent 7c28757 commit c6fb306
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions typescript/playground-common/src/baml_wasm_web/EventListener.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const vscodeSettingsAtom = unwrap(
} catch (e) {
console.error(`Error occurred while getting vscode settings:\n${e}`)
return {
enablePlaygroundProxy: false,
enablePlaygroundProxy: true,
}
}
}),
Expand Down Expand Up @@ -135,15 +135,21 @@ type Selection = {
}

export const envVarsAtom = atom((get) => {
const vscodeSettings = get(vscodeSettingsAtom)
if (vscodeSettings?.enablePlaygroundProxy !== undefined && !vscodeSettings?.enablePlaygroundProxy) {
// filter it out
if ((window as any).next?.version) {
// NextJS environment doesnt have vscode settings, and proxy is always enabled
return Object.fromEntries(defaultEnvKeyValues.map(([k, v]) => [k, v]))
} else {
const vscodeSettings = get(vscodeSettingsAtom)
console.log('vscodeSettings', vscodeSettings)
if (vscodeSettings?.enablePlaygroundProxy !== undefined && !vscodeSettings?.enablePlaygroundProxy) {
// filter it out
const envKeyValues = get(envKeyValuesAtom)
return Object.fromEntries(envKeyValues.map(([k, v]) => [k, v]).filter(([k]) => k !== 'BOUNDARY_PROXY_URL'))
}

const envKeyValues = get(envKeyValuesAtom)
return Object.fromEntries(envKeyValues.map(([k, v]) => [k, v]).filter(([k]) => k !== 'BOUNDARY_PROXY_URL'))
return Object.fromEntries(envKeyValues.map(([k, v]) => [k, v]))
}

const envKeyValues = get(envKeyValuesAtom)
return Object.fromEntries(envKeyValues.map(([k, v]) => [k, v]))
})

const selectedProjectAtom = atom(
Expand Down

0 comments on commit c6fb306

Please sign in to comment.