local M = {} local context = require('chatgpt_nvim.context') local handler = require('chatgpt_nvim.handler') function M.run_chatgpt_command() -- Prompt the user for input local user_input = vim.fn.input("Message for O1 Model: ") if user_input == "" then print("No input provided.") return end local project_structure = context.get_project_structure() local current_file_content, current_file_path = context.get_current_file() local readme_content = context.get_readme_content() local sections = { "Following you will get instructions for a development project. First you get a prompt of the user which starts with \"<< once you've pasted the prompt into the website and have the first file ready to copy.") vim.fn.input("") -- wait for user to press Enter while true do local another = vim.fn.input("Do you want to paste another file? (y/n): ") if another:lower() ~= "y" then handler.finish() break end -- Ask user for filepath local filepath = "" while true do print("Please copy the FILE PATH (the first line of the code block) to your clipboard.") print("Press when done.") vim.fn.input("") -- Wait for user confirmation filepath = handler.get_clipboard_content() if filepath == "" then vim.api.nvim_err_writeln("Clipboard is empty. Please copy the file path and try again.") else print("Got file path: " .. filepath) break end end -- Ask user for file content local filecontent = "" while true do print("Now copy the FILE CONTENT (everything after the first line) to your clipboard.") print("Press when done.") vim.fn.input("") -- Wait for user confirmation filecontent = handler.get_clipboard_content() if filecontent == "" then vim.api.nvim_err_writeln("Clipboard is empty. Please copy the file content and try again.") else break end end handler.write_file(filepath, filecontent) print("Wrote file: " .. filepath) end end return M