improve NotificationForChatGPTWeb (#710)

This commit is contained in:
josc146
2024-05-31 15:24:20 +08:00
parent 74e8c1fd08
commit 6f17e5cdf4
3 changed files with 9 additions and 3 deletions
+3 -1
View File
@@ -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,
},
@@ -71,7 +71,7 @@ const NotificationForChatGPTWeb = () => {
style={{
width: '440px',
}}
position="top-right"
position="top-center"
autoClose={7000}
newestOnTop={false}
closeOnClick={false}
+5 -1
View File
@@ -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)