What I’m doing:
Currently, I’m using OpenAI API with gpt-4-32k model to modify the user’s current opened file code.
In the prompt, I’m passing the currently opened files from the editor (which will be react.js code) along with a few instructions to optimize the code. Also, the project’s folder structure in neo-tree-like format has been added to the prompt.
When ChatGPT returns the final output, I directly replace it in current opened file.
I’m using Microsfot’s guidance library to generate the code.
Issues I’m facing:
When user’s file is too long, let’s say 500 lines of code, OpenAI comments the JSX part and updates rest of the code such as states, effects and functions. But, In JSX it uses placeholder stating “//rest of your code goes here”. such as below
import React from "react"
function Dashboard(props){
return(
<div>
{/* rest of your code goes here */}
</div>
)
}
This will be issue since user’s whole UI code will be removed.
What I Tried
- I tried calculating tokens, and input tokens along with instructions, code, and folder structure hardly gets to 11,000. which means I still have left ~20K tokens for output as I’m using gpt-4-32k model.
- I tried adding instructions such as “Always return the full page code even though it’s lengthy, Never comment any code portion”
Can anyone share the solution if you find any?