Skip to content

Commit c733ff5

Browse files
committed
Prevent duplicate finished-responding messages when apply button exists in AI Studio
1 parent 623974f commit c733ff5

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

  • apps/browser/src/content-scripts/send-prompt-content-script/chatbots

apps/browser/src/content-scripts/send-prompt-content-script/chatbots/ai-studio.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import browser from 'webextension-polyfill'
2+
import { Message } from '@/types/messages'
13
import { Chatbot } from '../types/chatbot'
24
import { CHATBOTS } from '@shared/constants/chatbots'
35
import { show_response_ready_notification } from '../utils/show-response-ready-notification'
@@ -436,7 +438,15 @@ export const ai_studio: Chatbot = {
436438
(span) => span.textContent?.trim() == 'thumb_up'
437439
)
438440
if (has_thumb_up) {
439-
show_response_ready_notification({ chatbot_name: 'AI Studio' })
441+
const has_apply_button = !!footer.querySelector(
442+
'.cwc-apply-response-button'
443+
)
444+
if (!has_apply_button) {
445+
browser.runtime.sendMessage<Message>({
446+
action: 'finished-responding'
447+
})
448+
show_response_ready_notification({ chatbot_name: 'AI Studio' })
449+
}
440450
add_buttons(footer)
441451
}
442452
})

0 commit comments

Comments
 (0)