forked from legendjw/ai-chat-sync
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtongyi-ai-chat.ts
38 lines (30 loc) · 1.16 KB
/
tongyi-ai-chat.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import { type SendKey } from '@/ai/abstract-ai-chat';
import InputElementAiChat from '@/ai/input-element-ai-chat';
// @ts-ignore
import iconUrl from 'data-url:@/assets/tongyi.png';
class TongYiAiChat extends InputElementAiChat {
id: string = "TongYi";
name: string = "通义千问";
icon: string = iconUrl;
url: string = "https://tongyi.aliyun.com/qianwen";
matches: string[] = ["*://tongyi.aliyun.com/qianwen*"];
queryInputElement(): HTMLInputElement | HTMLTextAreaElement | null {
return document.querySelector('div[class*="chatTextarea"] textarea,textarea');
}
querySendButtonElement(): HTMLElement | null {
return document.querySelector('div[class*="chatInput"] div[class*="operateBtn"]');
}
queryNewChatButtonElement(): HTMLElement | null {
return document.querySelector('div[class*="side"] button[class*="addBtn"]');
}
hasRelatedQuestions(): boolean {
return true;
}
queryRelatedQuestionsElement(): HTMLElement | null {
return document.querySelector('div[class*="suggestWrap"]');
}
sendKey(): SendKey[] {
return ["Enter"];
}
}
export default TongYiAiChat;