-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.ts
73 lines (63 loc) · 2.69 KB
/
utils.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import { readFileSync } from "fs";
import { AutoLoginInfo } from "./types";
export function loadHostKey(path: string): Buffer {
return readFileSync(path);
}
export function generateWelcomeMessage(
autoLoginInfo: AutoLoginInfo | null
): string {
const welcomeMessage = `
\x1b[35m
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: ::
:: ::
:: _ _ _ ::
:: __ _ _ _ ___ ___| |_(_) ___ _ __ ___| |__ ::
:: / _\` | | | |/ _ \\/ __| __| |/ _ \\| '_ \\ / __| '_ \\ ::
:: | (_| | |_| | __/\\__ \\ |_| | (_) | | | |_\\__ \\ | | | ::
:: \\__, |\\__,_|\\___||___/\\__|_|\\___/|_| |_(_)___/_| |_| ::
:: |_| ::
:: ::
:: ::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
\x1b[0m
🤖 Welcome to \x1b[1mquestion.sh\x1b[0m. Query LLMs from your terminal.
Conversations are not saved.
${
autoLoginInfo
? `\x1b[32mYou are logged in as ${
autoLoginInfo.username
}. You have $${autoLoginInfo.credits.toFixed(4)} credits.\x1b[0m`
: `\x1b[33mYou have $0.1000 credits as a guest. Use /register or /login to get more credits.\x1b[0m`
}
Current model: ${
autoLoginInfo?.selected_model || "anthropic/claude-3.5-haiku:beta"
}
Type your message and press Enter. Commands:
- Type "exit" to quit
- Type "/help" for all commands
`;
return welcomeMessage;
}
export function generateHelpMessage(): string {
return `
Available Commands:
/reset - Clear conversation history
/history - Show conversation history
/stats - Show session statistics
/system - Set system prompt
/clear - Clear screen
/retry - Retry last message with optional temperature:
/retry 0.8
/register - Register a new account
/login - Login to an existing account
/char - Manage characters (use /char for subcommands)
/adventure - Start a text-based RPG adventure
/model - List available models or select a model:
/model (list models)
/model <model_name> (select a model)
/balance - Check your current credit balance
exit - Exit the session`;
}