mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-01 10:04:12 +08:00
dev
This commit is contained in:
parent
833ca891d3
commit
1492ba2f6a
@ -7,4 +7,4 @@ class TS(commonllmdev):
|
|||||||
function1 = 'url.includes("conversation")'
|
function1 = 'url.includes("conversation")'
|
||||||
function2 = r"""thistext = chunk.message.content.parts[0]"""
|
function2 = r"""thistext = chunk.message.content.parts[0]"""
|
||||||
textarea_selector = "#prompt-textarea"
|
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"
|
||||||
|
@ -53,24 +53,24 @@ class commonllmdev(basetransdev):
|
|||||||
)
|
)
|
||||||
content = prompt + content
|
content = prompt + content
|
||||||
self.Runtime_evaluate(
|
self.Runtime_evaluate(
|
||||||
f"document.querySelector(`{self.textarea_selector}`).foucs()"
|
f"document.querySelector(`{repr(self.textarea_selector)}`).foucs()"
|
||||||
)
|
)
|
||||||
self.send_keys(content)
|
self.send_keys(content)
|
||||||
# chatgpt网站没有焦点时,用这个也可以。
|
# chatgpt网站没有焦点时,用这个也可以。
|
||||||
self.Runtime_evaluate(
|
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:
|
try:
|
||||||
# 月之暗面
|
# 月之暗面
|
||||||
while self.Runtime_evaluate(
|
while self.Runtime_evaluate(
|
||||||
f"document.querySelector(`{self.button_selector}`).disabled"
|
f"document.querySelector({repr(self.button_selector)}).disabled"
|
||||||
)["result"]["value"]:
|
)["result"]["value"]:
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
self.Runtime_evaluate(
|
self.Runtime_evaluate(
|
||||||
f"document.querySelector(`{self.button_selector}`).click()"
|
f"document.querySelector({repr(self.button_selector)}).click()"
|
||||||
)
|
)
|
||||||
if self.config["usingstream"]:
|
if self.config["usingstream"]:
|
||||||
curr = ""
|
curr = ""
|
||||||
|
10
LunaTranslator/LunaTranslator/translator/dev_theb.py
Normal file
10
LunaTranslator/LunaTranslator/translator/dev_theb.py
Normal 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"
|
@ -1585,6 +1585,13 @@
|
|||||||
"name": "chatgpt",
|
"name": "chatgpt",
|
||||||
"is_gpt_like": true
|
"is_gpt_like": true
|
||||||
},
|
},
|
||||||
|
"dev_theb": {
|
||||||
|
"use": false,
|
||||||
|
"color": "blue",
|
||||||
|
"type": "dev",
|
||||||
|
"name": "Theb.ai",
|
||||||
|
"is_gpt_like": true
|
||||||
|
},
|
||||||
"dev_moonshot": {
|
"dev_moonshot": {
|
||||||
"use": false,
|
"use": false,
|
||||||
"color": "blue",
|
"color": "blue",
|
||||||
|
@ -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": {
|
"dev_chatgpt_mirror": {
|
||||||
"args": {
|
"args": {
|
||||||
"target_url": "https://chatgpt.com/",
|
"target_url": "https://chatgpt.com/",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user