Skip to content

Commit fc62833

Browse files
koki-developclaude
andauthored
feat: Add ultrathink feature for extended thinking time (#5)
Co-authored-by: Claude <[email protected]>
1 parent 15f501d commit fc62833

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

β€Žsrc/lib/cat.tsβ€Ž

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,19 @@ const emotionKeywords: Record<Emotion, string[]> = {
211211
],
212212
} as const;
213213

214+
const ultrathinkKeywords = [
215+
"ultrathink",
216+
"think very hard",
217+
"think super hard",
218+
"think really hard",
219+
"think longer",
220+
"think intensely",
221+
"think harder",
222+
"η†Ÿθ€ƒ",
223+
"ζ·±γθ€ƒγˆγ¦",
224+
"γ—γ£γ‹γ‚Šθ€ƒγˆγ¦",
225+
] as const;
226+
214227
export class Cat {
215228
private fileEditor: FileEditor;
216229
private safeMode: boolean;
@@ -238,12 +251,15 @@ export class Cat {
238251
return responses[index] as string;
239252
}
240253

241-
private getRandomThinkingTime(): number {
242-
return Math.floor(Math.random() * 500) + 300; // 300-800ms
254+
private hasUltrathinkKeyword(message: string): boolean {
255+
return ultrathinkKeywords.some((keyword) => message.includes(keyword));
243256
}
244257

245258
async response(message: string): Promise<CatResponse> {
246-
const thinkingTime = this.getRandomThinkingTime();
259+
const isUltrathink = this.hasUltrathinkKeyword(message);
260+
const thinkingTime = isUltrathink
261+
? Math.floor(Math.random() * 2000) + 3000 // 3000-5000ms for ultrathink
262+
: Math.floor(Math.random() * 500) + 300; // 300-800ms
247263
await new Promise((resolve) => setTimeout(resolve, thinkingTime));
248264

249265
const emotion = this.detectEmotion(message);

0 commit comments

Comments
Β (0)