Skip to content

Commit

Permalink
Merge pull request #2 from Juan-LukeKlopper/minor-changes
Browse files Browse the repository at this point in the history
Feat: Make Minor-changes that are non-breaking
  • Loading branch information
Juan-LukeKlopper authored Jan 30, 2023
2 parents 99db331 + 2bd95fd commit dae9fbc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

<div class="flex ">
<div class="bg-white dark:bg-black w-1/5"/>
<textarea placeholder="Please enter the email you want to respond to" cols="30" rows="10" bind:value={text} class="w-3/5 h-6/12 text-center border-double border-2 border-black dark:border-white bg-mediumlightGray" />
<textarea placeholder="Please enter the information you want in the e-mail" cols="30" rows="10" bind:value={text} class="w-3/5 h-6/12 text-center border-double border-2 border-black dark:border-white bg-mediumlightGray" />
<div class="bg-white dark:bg-black w-1/5 "/>
</div>
<div class="flex my-4 justify-center justify-items-center">
Expand Down
5 changes: 3 additions & 2 deletions src/routes/api/generate/+server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ const openai = new OpenAIApi(configuration);
const basePromptPrefix = "Please rewrite this email to be profresional, Also fix the spelling and grammer Email:";
const basePromtSuffix = " Response: "

export const POST: RequestHandler = async (event) => {
export const POST: RequestHandler = async (event: any) => {
const request = await event.request.json();
const userInput: string = request['text'];


// Run first prompt
console.log(`API: ${basePromptPrefix}${userInput}${basePromtSuffix}`)
console.log(`UserInput: ${userInput}`)


const baseCompletion = await openai.createCompletion({
Expand All @@ -29,6 +29,7 @@ export const POST: RequestHandler = async (event) => {
});

const basePromptOutput = baseCompletion.data.choices.pop();
console.log(`BasePromptOutput: ${basePromptOutput}`)

return new Response(JSON.stringify({ output: basePromptOutput}), {
headers: {
Expand Down

0 comments on commit dae9fbc

Please sign in to comment.