Error when generating outline
Closed this issue · 2 comments
Issue when I press to generate an ouline:
Unhandled Rejection (TypeError): Cannot read properties of undefined (reading 'split')
_callee$
C:/Users/Julian/Documents/GitHub/bookwriter/src/App.js:60
57 | });
58 | let result = await resultPromise;
59 | // Remove all the lines before and including "# Outline"
60 | result = result.split("# Outline")[1];
| ^ 61 | console.log("Raw outline: ", result)
62 | setBook({
63 | ...book,
View compiled
tryCatch
C:/Users/Julian/Documents/GitHub/bookwriter/src/App.js:2
1 | // This is the main component of the app. It handles the state of the app and renders the appropriate view based on the currentView state.
2 |
3 | import React, { useState } from 'react';
4 | import DescriptionView from './Description';
5 | import OutlineView from './Outline';
View compiled
Generator.
C:/Users/Julian/Documents/GitHub/bookwriter/src/App.js:2
1 | // This is the main component of the app. It handles the state of the app and renders the appropriate view based on the currentView state.
2 |
3 | import React, { useState } from 'react';
4 | import DescriptionView from './Description';
5 | import OutlineView from './Outline';
View compiled
Generator.next
C:/Users/Julian/Documents/GitHub/bookwriter/src/App.js:2
1 | // This is the main component of the app. It handles the state of the app and renders the appropriate view based on the currentView state.
2 |
3 | import React, { useState } from 'react';
4 | import DescriptionView from './Description';
5 | import OutlineView from './Outline';
View compiled
▶ 2 stack frames were collapsed.
This screen is visible only in development. It will not appear if the app crashes in production.
Open your browser’s developer console to further inspect this error.
It seems that your api key was not correctly provided to the app.
I updated the README.md file so that the instructions are a little clearer.
In the root directory, you should create the file ".env"
It should contain the following line:
REACT_APP_OPENAI_API_KEY='sk-xxxxxxxxxxxxxxxxxx
Where sk-xxxxxxx is the API key that is provided to you by OpenAI. This article describes the process to acquire one.
Let me know if there is another issue.
No reply, assuming solved