Skip to content

Commit

Permalink
update new version
Browse files Browse the repository at this point in the history
  • Loading branch information
vaayne committed Apr 27, 2023
1 parent b717c05 commit 8c0da76
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 42 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## v0.0.18 - 2023-04-27
### Fixed
- Fix using chatgpt web
- Enhance error message

## v0.0.17 - 2023-04-25
### Added
- Support new bing as backend engine
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "notionai-plus",
"displayName": "NotionAI Plus",
"version": "0.0.17",
"version": "0.0.18",
"description": "NotionAI Plus is a browser extension that brings the power of NotionAI to any website you visit.",
"scripts": {
"dev": "plasmo dev",
Expand Down
14 changes: 7 additions & 7 deletions src/background/ports/stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import type { PlasmoMessaging } from "@plasmohq/messaging"

import { BardChat } from "~lib/api/bard"
import { BingChat } from "~lib/api/bing"
import { ChatStream } from "~lib/api/chatgpt-api"
import { PostChatGPTStream } from "~lib/api/chatgpt-web"
import { PostNotionStream } from "~lib/api/notion-completion"
import { ChatGPTApiChat } from "~lib/api/chatgpt-api"
import { ChatGPTWebChat } from "~lib/api/chatgpt-web"
import { NotionCompletion } from "~lib/api/notion-completion"
import { EngineEnum } from "~lib/enums"
import {
RequestBody,
Expand All @@ -22,13 +22,13 @@ const handler: PlasmoMessaging.PortHandler = async (req, res) => {

switch (body.engine) {
case EngineEnum.ChatGPTWeb:
await PostChatGPTStream(`${instruction}\n\n${prompt}`, res)
await ChatGPTWebChat(`${instruction}\n\n${prompt}`, res)
break
case EngineEnum.Bing:
await BingChat(`${instruction}\n\n${prompt}`, res)
break
case EngineEnum.ChatGPTAPI:
await ChatStream(
await ChatGPTApiChat(
OPENAI_API_URL,
instruction,
prompt,
Expand All @@ -40,7 +40,7 @@ const handler: PlasmoMessaging.PortHandler = async (req, res) => {
await BardChat(`${instruction}\n\n${prompt}`, res)
break
case EngineEnum.NotionBoy:
await ChatStream(
await ChatGPTApiChat(
NOTIONBOY_API_URL,
instruction,
prompt,
Expand All @@ -49,7 +49,7 @@ const handler: PlasmoMessaging.PortHandler = async (req, res) => {
)
break
case EngineEnum.NotionAI:
await PostNotionStream(
await NotionCompletion(
res,
body.builtinPrompt,
body.context,
Expand Down
4 changes: 2 additions & 2 deletions src/lib/api/chatgpt-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ async function chat(
})
}

async function ChatStream(
async function ChatGPTApiChat(
url: string,
instraction: string,
prompt: string,
Expand All @@ -78,4 +78,4 @@ async function ChatStream(
res.send(message)
}

export { ChatStream }
export { ChatGPTApiChat }
4 changes: 2 additions & 2 deletions src/lib/api/chatgpt-web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async function getAccessToken(): Promise<string> {
return data.accessToken
}

async function PostChatGPTStream(
async function ChatGPTWebChat(
prompt: string,
res: PlasmoMessaging.Response<any>
) {
Expand Down Expand Up @@ -120,4 +120,4 @@ async function removeConversation(id: string) {
}
}

export { PostChatGPTStream }
export { ChatGPTWebChat }
4 changes: 2 additions & 2 deletions src/lib/api/notion-completion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async function complation(
await processNdjsonResp(resp, onMessage)
}

async function PostNotionStream(
async function NotionCompletion(
res: PlasmoMessaging.Response<any>,
promptType: string,
context: string,
Expand Down Expand Up @@ -115,4 +115,4 @@ async function PostNotionStream(
res.send(message)
}

export { PostNotionStream }
export { NotionCompletion }
28 changes: 0 additions & 28 deletions src/lib/utils/fetch.ts

This file was deleted.

0 comments on commit 8c0da76

Please sign in to comment.