Skip to content

Commit 21b58eb

Browse files
tschoggetheusafTimeraaBas950
authored
feat(DeepSeek): add activity (#9226)
* fix(package-lock-version): upgraded cli version in package-lock.json * feat(deepseek): create a new presence * feat(deepseek): added a setting * feat(deepseek): added a setting * feat(deepseek): done with feature * feat(deepseek): done with feature * fix(deepseek): fixed lint * fix(deepseek): added 512x512 * fix(deepseek): removed old lang * fix(deepseek): removed comment * Update websites/D/DeepSeek/presence.ts change play and paused Co-authored-by: Daniel Lau <32113157+theusaf@users.noreply.github.com> Signed-off-by: Tschöggi <53406238+tschogge@users.noreply.github.com> * fix(deepseek): removed promise all * fix(deepseek): fixed logo * fix(deepseek): possible null and format * fix(deepseek): possible null --------- Signed-off-by: Tschöggi <53406238+tschogge@users.noreply.github.com> Co-authored-by: Daniel Lau <32113157+theusaf@users.noreply.github.com> Co-authored-by: Florian Metz <me@timeraa.dev> Co-authored-by: Bas van Zanten <me@bas950.com>
1 parent 387df2d commit 21b58eb

File tree

3 files changed

+116
-0
lines changed

3 files changed

+116
-0
lines changed

websites/D/DeepSeek/DeepSeek.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"deepSeek.startingPrompt": {
3+
"description": "Displayed when the user is on the page to start a new prompt.",
4+
"message": "Phrasing a new prompt..."
5+
},
6+
"deepSeek.talkingWithAi": {
7+
"description": "Displayed when the user is engaging in a conversation with the AI and the Chat title is not shown",
8+
"message": "Talking with AI about something"
9+
},
10+
"deepSeek.aiTalking": {
11+
"description": "Displayed when the AI is generating a response.",
12+
"message": "AI is responding..."
13+
},
14+
"deepSeek.readingResponse": {
15+
"description": "Displayed when the user is reading the response of the AI.",
16+
"message": "Reading the AI's response"
17+
},
18+
"deepSeek.askingQuestion": {
19+
"description": "Displayed when the user is asking a question.",
20+
"message": "Asking a question..."
21+
}
22+
}

websites/D/DeepSeek/metadata.json

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
{
2+
"$schema": "https://schemas.premid.app/metadata/1.13",
3+
"apiVersion": 1,
4+
"author": {
5+
"id": "1167417152664522764",
6+
"name": "Kaktuswerk"
7+
},
8+
"service": "DeepSeek",
9+
"description": {
10+
"en": "DeepSeek-V3 achieves a significant breakthrough in inference speed over previous models. It tops the leaderboard among open-source models and rivals the most advanced closed-source models globally."
11+
},
12+
"url": "chat.deepseek.com",
13+
"version": "1.0.0",
14+
"logo": "https://i.imgur.com/QfuHG4T.png",
15+
"thumbnail": "https://i.imgur.com/xSgmreb.png",
16+
"color": "#2885d1",
17+
"category": "other",
18+
"tags": [
19+
"ai",
20+
"chat",
21+
"chatbot",
22+
"conversations"
23+
],
24+
"settings": [
25+
{
26+
"id": "lang",
27+
"multiLanguage": true
28+
},
29+
{
30+
"id": "showTitle",
31+
"title": "Show chat title",
32+
"icon": "fa-solid fa-message-quote",
33+
"value": true
34+
}
35+
]
36+
}

websites/D/DeepSeek/presence.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
const presence = new Presence({
2+
clientId: '1333939310441009182',
3+
})
4+
async function getStrings() {
5+
return presence.getStrings({
6+
play: 'general.playing',
7+
pause: 'general.paused',
8+
newPrompt: 'deepSeek.startingPrompt',
9+
talkingWithAi: 'deepSeek.talkingWithAi',
10+
aiTalking: 'deepSeek.aiTalking',
11+
readingResponse: 'deepSeek.readingResponse',
12+
askingQuestion: 'deepSeek.askingQuestion',
13+
})
14+
}
15+
const browsingTimestamp = Math.floor(Date.now() / 1000)
16+
17+
enum Assets {
18+
Logo = 'https://i.imgur.com/QfuHG4T.png',
19+
}
20+
21+
presence.on('UpdateData', async () => {
22+
const { pathname } = document.location
23+
const showTitle = await presence.getSetting<boolean>('showTitle')
24+
25+
let presenceDetail: string, presenceState: string
26+
27+
const strings = await getStrings()
28+
29+
if (pathname === '/') {
30+
presenceDetail = strings?.newPrompt ?? ''
31+
}
32+
else if (pathname.includes('/a/chat/s')) {
33+
presenceDetail = (showTitle
34+
? document.querySelector('div.d8ed659a')?.textContent
35+
: strings?.talkingWithAi) ?? ''
36+
}
37+
else {
38+
presenceDetail = strings?.talkingWithAi ?? ''
39+
}
40+
41+
// Used for checking if the AI is currently responding
42+
43+
// Checking if the user is currently typing a question
44+
if (document.querySelector('#chat-input')?.textContent !== '')
45+
presenceState = strings?.askingQuestion ?? ''
46+
else if (document.querySelector('div[class=\'f9bf7997 d7dc56a8\']'))
47+
presenceState = strings?.aiTalking ?? ''
48+
else if (document.querySelector('div.f9bf7997.d7dc56a8.c05b5566'))
49+
presenceState = strings?.readingResponse ?? ''
50+
else presenceState = ''
51+
52+
presence.setActivity({
53+
largeImageKey: Assets.Logo,
54+
startTimestamp: browsingTimestamp,
55+
details: presenceDetail,
56+
state: presenceState,
57+
})
58+
})

0 commit comments

Comments
 (0)