Skip to content

Commit

Permalink
Update Notion completion API parameters to fix 400 error
Browse files Browse the repository at this point in the history
  • Loading branch information
vaayne committed Jan 7, 2024
1 parent 5cd26a5 commit 3f8c7c9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/lib/api/notion-completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { v4 as uuidv4 } from "uuid"
import { PromptTypeEnum } from "~lib/enums"
import { processNdjsonResp } from "~lib/utils/ndjson"

const MODEL = "openai-4"
const MODEL = "default"
const HOST = "https://www.notion.so"

async function complation(
Expand All @@ -22,6 +22,11 @@ async function complation(
spaceId: notionSpaceId,
isSpacePermission: false,
context: {},
inferenceReason: "writer",
aiSessionId: uuidv4(),
metadata: {
blockId: uuidv4
}
}

if (promptType === PromptTypeEnum.Translate) {
Expand Down Expand Up @@ -77,7 +82,7 @@ async function complation(
fullMessage += msg.completion
port.postMessage(fullMessage)
} else {
port.postMessage(msg.completion)
port.postMessage(`NotionAI return error: ${msg.message}`)
}
}
await processNdjsonResp(resp, onMessage)
Expand Down

0 comments on commit 3f8c7c9

Please sign in to comment.