• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

lucasliet / llm-telegram-bot / 23172248446

17 Mar 2026 12:19AM UTC coverage: 54.15% (-0.4%) from 54.504%
23172248446

push

github

lucasliet
feat: add Groq provider and provider-builder skill

183 of 377 branches covered (48.54%)

Branch coverage included in aggregate %.

21 of 37 new or added lines in 5 files covered. (56.76%)

201 existing lines in 7 files now uncovered.

2988 of 5479 relevant lines covered (54.54%)

18.09 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.33
/src/repository/ChatRepository.ts
1
import { compressObject, decompressObject } from 'textcompress';
23✔
2
import OpenAI from 'openai';
3
import { ModelCommand } from '@/config/models.ts';
4

5
const kv = await Deno.openKv();
23✔
6

7
const THIRTY_DAYS_IN_MILLIS = 60 * 60 * 24 * 1000 * 30;
23✔
8

9
/**
1✔
10
 * Get chat history for a user
11
 */
23✔
12
export async function getChatHistory(userKey: string): Promise<OpenAI.ChatCompletionMessageParam[]> {
23✔
13
        const compressed = (await kv.get<string>([userKey, 'chat-history'])).value;
140✔
14

15
        if (!compressed) {
35✔
16
                return [];
44✔
17
        }
44✔
18

19
        return decompressObject<OpenAI.ChatCompletionMessageParam[]>(compressed);
38✔
20
}
35✔
21

22
/**
1✔
23
 * Add new content to chat history
24
 */
23✔
25
export async function addContentToChatHistory(
23✔
26
        history: OpenAI.ChatCompletionMessageParam[],
23✔
27
        userPrompt: string,
23✔
28
        modelPrompt: string,
23✔
29
        userKey: string,
23✔
30
): Promise<void> {
31
        history = [
28✔
32
                ...history,
28✔
33
                { role: 'user', content: userPrompt },
112✔
34
                { role: 'assistant', content: modelPrompt },
112✔
35
        ];
28✔
36

37
        await saveHistoryToStorage(history, userKey);
28✔
38
}
28✔
39

40
/**
1✔
41
 * Save chat history to storage with compression
42
 */
23✔
43
async function saveHistoryToStorage(history: OpenAI.ChatCompletionMessageParam[], userKey: string): Promise<void> {
23✔
44
        const compressed = compressObject(history);
28✔
45
        await kv.set([userKey, 'chat-history'], compressed, {
112✔
46
                expireIn: THIRTY_DAYS_IN_MILLIS,
28✔
47
        });
28✔
48
}
28✔
49

50
/**
1✔
51
 * Clear chat history for a user
52
 */
23✔
53
export async function clearChatHistory(userKey: string): Promise<void> {
23✔
54
        await kv.delete([userKey, 'chat-history']);
96✔
55
}
24✔
56

57
/**
1✔
58
 * Overwrite chat history with a new history (used after compression)
UNCOV
59
 */
×
UNCOV
60
export async function overwriteChatHistory(userKey: string, history: OpenAI.ChatCompletionMessageParam[]): Promise<void> {
×
UNCOV
61
        const compressed = compressObject(history);
×
UNCOV
62
        await kv.set([userKey, 'chat-history'], compressed, {
×
UNCOV
63
                expireIn: THIRTY_DAYS_IN_MILLIS,
×
UNCOV
64
        });
×
UNCOV
65
}
×
66

67
/**
1✔
68
 * Set user's current model preference
69
 */
23✔
70
export async function setCurrentModel(userKey: string, model: ModelCommand = '/polli'): Promise<void> {
23✔
71
        await kv.set([userKey, 'current_model'], model);
116✔
72
}
29✔
73

74
/**
1✔
75
 * Get user's current model preference (defaults to /polli)
76
 */
23✔
77
export async function getCurrentModel(userKey: string): Promise<ModelCommand> {
23✔
78
        return (await kv.get<ModelCommand>([userKey, 'current_model'])).value || '/polli';
100✔
79
}
25✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc