Readme | 说明
3. Open http://127.0.0.1:5000 in your browser
This tool is an e-book parsing and conversation tool based on ChatGPT. It includes a simple GUI conversation interface implemented using Flask, and a web interface for parsing e-books:
1 Upon first opening the interface, the user needs to enter their OpenAI API Key. The program will save it in a cookie and provide a way for the user to delete the key. The program calls OpenAI's function to validate the API Key's effectiveness, ensuring it's usable.
2 With a valid API Key, the epub file upload button becomes visible. Users can click the button or drag and drop an epub file onto the GUI interface. The program will upload the file to the "uploads" folder. Subsequently, the program will perform the following tasks in sequence: extract content from the entire book, perform recursive summarization, and compute text-embeddings. This process generates a csv file with the same name as the uploaded file, storing summarized content, and a *_embedding.csv file, storing text-embedding values. After this process is completed, the program can be used to engage in conversations surrounding the details and main ideas of the book.
3 At this point, users can enter any text in the input box at the bottom of the interface. The program calls the process_input function in the background to traverse all csv files in the "uploads" folder and analyze the entered text. It retrieves background text as answer material based on similarity, calls the OpenAI API to generate an answer, and returns it to the GUI interface.
4 Conversation records can be downloaded by clicking the link on the interface.