I’m trying to import text articles into chatGPT that will interact with a series of prompts I have put together.
I was trying to automate it by uploading a .txt file to my Google Drive and then feeding the information to ChatGPT. But I’m not seeing an obvious no-code way to do it since I can’t see the contents of the .txt file within GDrive.
My next step is to extract the text with Python. But are there any obvious ways that this could be done that I don’t know about?
Thanks Thomas! I was actually following your tutorial for transcripts to Notion and with some help from ChatGPT (and your code from the tutorial) I got something working. I’ll compare it to what you have here, I’m sure yours is more complete. Below is what I used. I had the same three steps you mentioned above.
// Import required modules
import fs from 'fs';
import { promisify } from 'util';
// Promisify the readFile function for easier use with async/await
const readFile = promisify(fs.readFile);
// Define the component
export default defineComponent({
async run({ $ }) {
// Define the path to the text file
const path = '/tmp/textfile.txt';
try {
// Read the contents of the text file using the promisified readFile function
const data = await readFile(path, 'utf8');
// Create a results object containing the text file contents
const results = {
textFileContents: data,
};
// Return the results object, which will be exported from this step
return results;
} catch (err) {
// Log the error and re-throw it for further handling
console.error(err);
throw err;
}
},
});
This turns the wall-of-text transcript string into paragraphs that have line breaks between them. Makes it much easier to read.
In the code-heavy version, I have to make sure I’m staying within the Notion API’s request limits. Splitting the transcript into paragraphs helps with that.
Hi Guys
Following this discussion I’m getting success till I get to “format_chat” stage.
(fercaralt: I tweaked your last bit of code from “tmp/textfile.txt” to “tmp/text.txt” - hope that’s right…)
Does the code for the format_chat stage need to change from the standard (Heavy-Code) instructions ?