improve prompting + add dockerfile for ws

This commit is contained in:
Ishaan Dey 2024-05-03 12:56:44 -07:00
parent 2bfaf428d9
commit 6e28d283cd
4 changed files with 40 additions and 12 deletions

1
.gitignore vendored
View File

@ -38,5 +38,6 @@ next-env.d.ts
wrangler.toml wrangler.toml
backend/server/dist
backend/server/projects backend/server/projects
backend/database/drizzle backend/database/drizzle

View File

@ -185,15 +185,21 @@ io.on("connection", (socket) => __awaiter(void 0, void 0, void 0, function* () {
messages: [ messages: [
{ {
role: "system", role: "system",
content: "You are an expert coding assistant. You read code from a file, and you suggest new code to add to the file. You may be given instructions on what to generate, which you should follow. You should generate code that is correct, efficient, and follows best practices. You should also generate code that is clear and easy to read.", content: "You are an expert coding assistant. You read code from a file, and you suggest new code to add to the file. You may be given instructions on what to generate, which you should follow. You should generate code that is correct, efficient, and follows best practices. You should also generate code that is clear and easy to read. When you generate code, you should only return the code, and nothing else. You should not include backticks in the code you generate.",
}, },
{ {
role: "user", role: "user",
content: `The file is called ${fileName}. Here are my instructions on what to generate: ${instructions}. Suggest me code to insert at line ${line} in my file. content: `The file is called ${fileName}.`,
},
My code file content: ${code} {
role: "user",
Return only the code, and nothing else. Do not include backticks.`, content: `Here are my instructions on what to generate: ${instructions}.`,
},
{
role: "user",
content: `Suggest me code to insert at line ${line} in my file. Give only the code, and NOTHING else. DO NOT include backticks in your response. My code file content is as follows
${code}`,
}, },
], ],
}), }),

15
backend/server/dockerfile Normal file
View File

@ -0,0 +1,15 @@
FROM node:20
WORKDIR /code
COPY package*.json ./
RUN npm install
COPY . .
RUN npm run build
EXPOSE 3000
CMD [ "node", "dist/index.js" ]

View File

@ -229,15 +229,21 @@ io.on("connection", async (socket) => {
{ {
role: "system", role: "system",
content: content:
"You are an expert coding assistant. You read code from a file, and you suggest new code to add to the file. You may be given instructions on what to generate, which you should follow. You should generate code that is correct, efficient, and follows best practices. You should also generate code that is clear and easy to read.", "You are an expert coding assistant. You read code from a file, and you suggest new code to add to the file. You may be given instructions on what to generate, which you should follow. You should generate code that is correct, efficient, and follows best practices. You should also generate code that is clear and easy to read. When you generate code, you should only return the code, and nothing else. You should not include backticks in the code you generate.",
}, },
{ {
role: "user", role: "user",
content: `The file is called ${fileName}. Here are my instructions on what to generate: ${instructions}. Suggest me code to insert at line ${line} in my file. content: `The file is called ${fileName}.`,
},
My code file content: ${code} {
role: "user",
Return only the code, and nothing else. Do not include backticks.`, content: `Here are my instructions on what to generate: ${instructions}.`,
},
{
role: "user",
content: `Suggest me code to insert at line ${line} in my file. Give only the code, and NOTHING else. DO NOT include backticks in your response. My code file content is as follows
${code}`,
}, },
], ],
}), }),