mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 04:11:10 -05:00
Customize for Roo
This commit is contained in:
@@ -63,6 +63,8 @@ export interface ExtensionStateContextType extends ExtensionState {
|
||||
setCustomPrompts: (value: CustomPrompts) => void
|
||||
enhancementApiConfigId?: string
|
||||
setEnhancementApiConfigId: (value: string) => void
|
||||
autoApprovalEnabled?: boolean
|
||||
setAutoApprovalEnabled: (value: boolean) => void
|
||||
}
|
||||
|
||||
export const ExtensionStateContext = createContext<ExtensionStateContextType | undefined>(undefined)
|
||||
@@ -121,11 +123,22 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
|
||||
const message: ExtensionMessage = event.data
|
||||
switch (message.type) {
|
||||
case "state": {
|
||||
const newState = message.state!
|
||||
// Set autoApprovalEnabled to true if undefined and any individual flag is true
|
||||
if (newState.autoApprovalEnabled === undefined) {
|
||||
newState.autoApprovalEnabled = !!(
|
||||
newState.alwaysAllowBrowser ||
|
||||
newState.alwaysAllowReadOnly ||
|
||||
newState.alwaysAllowWrite ||
|
||||
newState.alwaysAllowExecute ||
|
||||
newState.alwaysAllowMcp ||
|
||||
newState.alwaysApproveResubmit)
|
||||
}
|
||||
setState(prevState => ({
|
||||
...prevState,
|
||||
...message.state!
|
||||
...newState
|
||||
}))
|
||||
const config = message.state?.apiConfiguration
|
||||
const config = newState.apiConfiguration
|
||||
const hasKey = checkExistKey(config)
|
||||
setShowWelcome(!hasKey)
|
||||
setDidHydrateState(true)
|
||||
@@ -237,6 +250,7 @@ export const ExtensionStateContextProvider: React.FC<{ children: React.ReactNode
|
||||
setMode: (value: Mode) => setState((prevState) => ({ ...prevState, mode: value })),
|
||||
setCustomPrompts: (value) => setState((prevState) => ({ ...prevState, customPrompts: value })),
|
||||
setEnhancementApiConfigId: (value) => setState((prevState) => ({ ...prevState, enhancementApiConfigId: value })),
|
||||
setAutoApprovalEnabled: (value) => setState((prevState) => ({ ...prevState, autoApprovalEnabled: value })),
|
||||
}
|
||||
|
||||
return <ExtensionStateContext.Provider value={contextValue}>{children}</ExtensionStateContext.Provider>
|
||||
|
||||
Reference in New Issue
Block a user