This commit is contained in:
恍兮惚兮 2024-08-14 01:02:58 +08:00
parent 833ca891d3
commit 1492ba2f6a
5 changed files with 40 additions and 5 deletions

View File

@ -7,4 +7,4 @@ class TS(commonllmdev):
function1 = 'url.includes("conversation")'
function2 = r"""thistext = chunk.message.content.parts[0]"""
textarea_selector = "#prompt-textarea"
button_selector = r"#__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div > main > div.flex.h-full.flex-col.focus-visible\\:outline-0 > div.md\\:pt-0.dark\\:border-white\\/20.md\\:border-transparent.md\\:dark\\:border-transparent.w-full > div.text-base.px-3.md\\:px-4.m-auto.md\\:px-5.lg\\:px-1.xl\\:px-5 > div > form > div > div.flex.w-full.items-center > div > div > button"
button_selector = r"#__next > div.relative.z-0.flex.h-full.w-full.overflow-hidden > div > main > div.flex.h-full.flex-col.focus-visible\:outline-0 > div.md\:pt-0.dark\:border-white\/20.md\:border-transparent.md\:dark\:border-transparent.w-full > div.text-base.px-3.md\:px-4.m-auto.md\:px-5.lg\:px-1.xl\:px-5 > div > form > div > div.flex.w-full.items-center > div > div > button"

View File

@ -53,24 +53,24 @@ class commonllmdev(basetransdev):
)
content = prompt + content
self.Runtime_evaluate(
f"document.querySelector(`{self.textarea_selector}`).foucs()"
f"document.querySelector(`{repr(self.textarea_selector)}`).foucs()"
)
self.send_keys(content)
# chatgpt网站没有焦点时用这个也可以。
self.Runtime_evaluate(
f'textarea=document.querySelector(`{self.textarea_selector}`);textarea.value="";event = new Event("input", {{bubbles: true, cancelable: true }});textarea.dispatchEvent(event);textarea.value=`{content}`;event = new Event("input", {{bubbles: true, cancelable: true }});textarea.dispatchEvent(event);'
f'textarea=document.querySelector({repr(self.textarea_selector)});textarea.value="";event = new Event("input", {{bubbles: true, cancelable: true }});textarea.dispatchEvent(event);textarea.value=`{content}`;event = new Event("input", {{bubbles: true, cancelable: true }});textarea.dispatchEvent(event);'
)
try:
# 月之暗面
while self.Runtime_evaluate(
f"document.querySelector(`{self.button_selector}`).disabled"
f"document.querySelector({repr(self.button_selector)}).disabled"
)["result"]["value"]:
time.sleep(0.1)
except:
pass
self.Runtime_evaluate(
f"document.querySelector(`{self.button_selector}`).click()"
f"document.querySelector({repr(self.button_selector)}).click()"
)
if self.config["usingstream"]:
curr = ""

View File

@ -0,0 +1,10 @@
from translator.dev_llm_common import commonllmdev
class TS(commonllmdev):
target_url = "https://beta.theb.ai/home"
jsfile = "commonhookfetchstream.js"
function1 = 'url.includes("api/conversation")'
function2 = "thistext = chunk.args.content"
button_selector = r"#INPUT > div > div.max-w-\[66rem\].m-auto.z-2.border-2.border-n-3.rounded-xl.overflow-hidden.dark\:border-n-5.bg-white.dark\:bg-n-6 > div > button.group.absolute.right-3.bottom-2.rounded-xl.transition-colors.disabled\:bg-slate-400.disabled\:hover\:bg-slate-400.disabled\:cursor-no-drop.w-10.h-10.bg-primary-1.hover\:bg-primary-1\/90"
textarea_selector = "#textareaAutosize"

View File

@ -1585,6 +1585,13 @@
"name": "chatgpt",
"is_gpt_like": true
},
"dev_theb": {
"use": false,
"color": "blue",
"type": "dev",
"name": "Theb.ai",
"is_gpt_like": true
},
"dev_moonshot": {
"use": false,
"color": "blue",

View File

@ -830,6 +830,24 @@
}
}
},
"dev_theb": {
"args": {
"usingstream": true,
"use_custom_prompt": false,
"custom_prompt": ""
},
"argstype": {
"usingstream": {
"name": "流式输出",
"type": "switch"
},
"custom_prompt": {
"name": "自定义_promt",
"type": "multiline",
"refswitch": "use_custom_prompt"
}
}
},
"dev_chatgpt_mirror": {
"args": {
"target_url": "https://chatgpt.com/",