chatgpt-google-summary-extension
chatgpt-google-summary-extension copied to clipboard
Errors when loading the self-built package to chrome
Describe the bug I cloned the latest main branch and built it locally following the instructions. Chrome shows errors when I load the package. The error messages are:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'config')
Context
options.html
Stack Trace
options.js:203 (anonymous function)
Uncaught (in promise) TypeError: Cannot set properties of undefined (setting 'apiKey')
Context
https://github.com/sparticleinc/chatgpt-google-summary-extension/issues/new/choose
Stack Trace
content-script.js:6 (anonymous function)
Desktop (please complete the following information):
- OS: MacOS
- Browser: Chrome
- Version: https://github.com/sparticleinc/chatgpt-google-summary-extension/tree/2fe8cdeed80ef816bd53074ef17dd23cde25d22a
I got the same problem
Was able to resolve this by modifying src/options/ProviderSelect.tsx
function ProviderSelect() {
...
if (query.isLoading) {
return <Spinner />
}
// Added this
if (query.error) {
return <div>Error loading provider configurations.</div>
}
// Don't think you need this but added it to be safe
if (!query.data || !query.data.config) {
return <div>No provider configurations found.</div>
}
return <ConfigPanel config={query.data!.config} models={models} />
}
as well as src/config/index.ts
export async function getProviderConfigs(): Promise<ProviderConfigs> {
...
// Ensure result[configKey] is not undefined
if (!result[configKey]) {
result[configKey] = {}
}
result[configKey].apiKey = apiKey
return {
provider,
configs: {
[ProviderType.GPT3]: result[configKey],
},
}
}
Thanks @dillontkh It has worked for me. Made a PR