Skip to content

Commit

Permalink
improve NotificationForChatGPTWeb (josStorer#710)
Browse files Browse the repository at this point in the history
  • Loading branch information
josStorer authored and missdeer committed Jun 3, 2024
1 parent 6dab64c commit 9aa92bb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/components/MarkdownRender/Hyperlink.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,12 @@ export function Hyperlink({ href, children }) {
<span
{...linkProperties}
onClick={() => {
const url = new URL(href)
url.searchParams.set('chatgptbox_notification', 'true')
Browser.runtime.sendMessage({
type: 'NEW_URL',
data: {
url: href,
url: url.toString(),
pinned: false,
saveAsChatgptConfig: true,
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/NotificationForChatGPTWeb/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const NotificationForChatGPTWeb = () => {
style={{
width: '440px',
}}
position="top-right"
position="top-center"
autoClose={7000}
newestOnTop={false}
closeOnClick={false}
Expand Down
6 changes: 5 additions & 1 deletion src/content-script/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,11 @@ async function prepareForForegroundRequests() {

if (!chatgptWebModelKeys.some((model) => userConfig.activeApiModes.includes(model))) return

if (chatgptWebModelKeys.includes(userConfig.modelName)) {
const url = new URL(window.location.href)
if (
url.searchParams.has('chatgptbox_notification') &&
chatgptWebModelKeys.includes(userConfig.modelName)
) {
const div = document.createElement('div')
document.body.append(div)
render(<NotificationForChatGPTWeb container={div} />, div)
Expand Down

0 comments on commit 9aa92bb

Please sign in to comment.