1pub const VERSION: &str = env!("CARGO_PKG_VERSION");
8
9pub const APP_NAME: &str = "work-copilot";
11
12pub const AUTHOR: &str = "lingojack";
14
15pub const EMAIL: &str = "lingojack@qq.com";
17
18pub const CONFIG_FIELDS: &[&str] = &["name", "api_base", "api_key", "model"];
20pub const CONFIG_GLOBAL_FIELDS: &[&str] = &[
22 "system_prompt",
23 "style",
24 "stream_mode",
25 "max_history_messages",
26 "theme",
27 "tools_enabled",
28 "max_tool_rounds",
29];
30
31pub const TOAST_DURATION_SECS: u64 = 4;
33
34pub mod section {
38 pub const PATH: &str = "path";
39 pub const INNER_URL: &str = "inner_url";
40 pub const OUTER_URL: &str = "outer_url";
41 pub const EDITOR: &str = "editor";
42 pub const BROWSER: &str = "browser";
43 pub const VPN: &str = "vpn";
44 pub const SCRIPT: &str = "script";
45 pub const VERSION: &str = "version";
46 pub const SETTING: &str = "setting";
47 pub const LOG: &str = "log";
48 pub const REPORT: &str = "report";
49}
50
51pub const ALL_SECTIONS: &[&str] = &[
53 section::PATH,
54 section::INNER_URL,
55 section::OUTER_URL,
56 section::EDITOR,
57 section::BROWSER,
58 section::VPN,
59 section::SCRIPT,
60 section::VERSION,
61 section::SETTING,
62 section::LOG,
63 section::REPORT,
64];
65
66pub const DEFAULT_DISPLAY_SECTIONS: &[&str] = &[
68 section::PATH,
69 section::INNER_URL,
70 section::OUTER_URL,
71 section::EDITOR,
72 section::BROWSER,
73 section::VPN,
74 section::SCRIPT,
75];
76
77pub const CONTAIN_SEARCH_SECTIONS: &[&str] = &[
79 section::PATH,
80 section::SCRIPT,
81 section::BROWSER,
82 section::EDITOR,
83 section::VPN,
84 section::INNER_URL,
85 section::OUTER_URL,
86];
87
88pub const NOTE_CATEGORIES: &[&str] = &[
92 section::BROWSER,
93 section::EDITOR,
94 section::VPN,
95 section::OUTER_URL,
96 section::SCRIPT,
97];
98
99pub const ALIAS_PATH_SECTIONS: &[&str] = &[section::PATH, section::INNER_URL, section::OUTER_URL];
103
104pub const ALIAS_EXISTS_SECTIONS: &[&str] = &[
106 section::PATH,
107 section::INNER_URL,
108 section::OUTER_URL,
109 section::SCRIPT,
110 section::BROWSER,
111 section::EDITOR,
112 section::VPN,
113];
114
115pub const MODIFY_SECTIONS: &[&str] = &[
117 section::PATH,
118 section::INNER_URL,
119 section::OUTER_URL,
120 section::EDITOR,
121 section::BROWSER,
122 section::VPN,
123];
124
125pub const REMOVE_CLEANUP_SECTIONS: &[&str] = &[
127 section::EDITOR,
128 section::VPN,
129 section::BROWSER,
130 section::SCRIPT,
131];
132
133pub const RENAME_SYNC_SECTIONS: &[&str] = &[
135 section::BROWSER,
136 section::EDITOR,
137 section::VPN,
138 section::SCRIPT,
139];
140
141pub mod config_key {
145 pub const MODE: &str = "mode";
146 pub const VERBOSE: &str = "verbose";
147 pub const CONCISE: &str = "concise";
148 pub const SEARCH_ENGINE: &str = "search-engine";
149 pub const WEEK_REPORT: &str = "week_report";
150 pub const WEEK_NUM: &str = "week_num";
151 pub const LAST_DAY: &str = "last_day";
152 pub const GIT_REPO: &str = "git_repo";
153}
154
155pub const DEFAULT_SEARCH_ENGINE: &str = "bing";
159
160pub mod search_engine {
162 pub const GOOGLE: &str = "https://www.google.com/search?q={}";
163 pub const BING: &str = "https://www.bing.com/search?q={}";
164 pub const BAIDU: &str = "https://www.baidu.com/s?wd={}";
165}
166
167pub const REPORT_DATE_FORMAT: &str = "%Y.%m.%d";
171
172pub const REPORT_SIMPLE_DATE_FORMAT: &str = "%Y/%m/%d";
174
175pub const DEFAULT_CHECK_LINES: usize = 10;
177
178pub mod cmd {
183 pub const SET: &[&str] = &["set", "s"];
185 pub const REMOVE: &[&str] = &["rm", "remove"];
186 pub const RENAME: &[&str] = &["rename", "rn"];
187 pub const MODIFY: &[&str] = &["mf", "modify"];
188
189 pub const NOTE: &[&str] = &["note", "nt"];
191 pub const DENOTE: &[&str] = &["denote", "dnt"];
192
193 pub const LIST: &[&str] = &["ls", "list"];
195 pub const CONTAIN: &[&str] = &["contain", "find"];
196
197 pub const REPORT: &[&str] = &["report", "r"];
199 pub const REPORTCTL: &[&str] = &["reportctl", "rctl"];
200 pub const CHECK: &[&str] = &["check", "c"];
201 pub const SEARCH: &[&str] = &["search", "select", "look", "sch"];
202
203 pub const TODO: &[&str] = &["todo", "td"];
205
206 pub const CONCAT: &[&str] = &["concat"];
208
209 pub const TIME: &[&str] = &["time"];
211
212 pub const LOG: &[&str] = &["log"];
214 pub const CHANGE: &[&str] = &["change", "chg"];
215 pub const CLEAR: &[&str] = &["clear", "cls"];
216
217 pub const VERSION: &[&str] = &["version", "v"];
219 pub const HELP: &[&str] = &["help", "h"];
220 pub const EXIT: &[&str] = &["exit", "q", "quit"];
221
222 pub const COMPLETION: &[&str] = &["completion"];
224
225 pub const CHAT: &[&str] = &["chat", "ai"];
227
228 pub const VOICE: &[&str] = &["voice", "vc"];
230
231 pub const AGENT: &[&str] = &["agent"];
233 pub const SYSTEM: &[&str] = &["system", "ps"];
234
235 pub fn all_keywords() -> Vec<&'static str> {
237 let groups: &[&[&str]] = &[
238 SET, REMOVE, RENAME, MODIFY, NOTE, DENOTE, LIST, CONTAIN, REPORT, REPORTCTL, CHECK,
239 SEARCH, TODO, CHAT, CONCAT, TIME, LOG, CHANGE, CLEAR, VERSION, HELP, EXIT, COMPLETION,
240 VOICE, AGENT, SYSTEM,
241 ];
242 groups.iter().flat_map(|g| g.iter().copied()).collect()
243 }
244}
245
246pub mod rmeta_action {
249 pub const NEW: &str = "new";
250 pub const SYNC: &str = "sync";
251 pub const PUSH: &str = "push";
252 pub const PULL: &str = "pull";
253 pub const SET_URL: &str = "set-url";
254 pub const OPEN: &str = "open";
255}
256
257pub mod time_function {
260 pub const COUNTDOWN: &str = "countdown";
261}
262
263pub mod search_flag {
266 pub const FUZZY_SHORT: &str = "-f";
267 pub const FUZZY: &str = "-fuzzy";
268}
269
270pub const LIST_ALL: &str = "all";
273
274pub const WELCOME_MESSAGE: &str = "Welcome to use j-cli 🚀 ~";
278
279pub const SHELL_PREFIX: char = '!';
281
282pub const INTERACTIVE_PROMPT: &str = "j >";
284
285pub const HISTORY_FILE: &str = "history.txt";
287
288pub const CONFIG_FILE: &str = "config.yaml";
290
291pub const SCRIPTS_DIR: &str = "scripts";
293
294pub const REPORT_DIR: &str = "report";
296
297pub const AGENT_DIR: &str = "agent";
299
300pub const AGENT_LOG_DIR: &str = "logs";
302
303pub const REPORT_DEFAULT_FILE: &str = "week_report.md";
305
306pub const DATA_DIR: &str = ".jdata";
308
309pub const DATA_PATH_ENV: &str = "J_DATA_PATH";
311
312pub mod voice {
318 pub const VOICE_DIR: &str = "voice";
320 pub const MODEL_DIR: &str = "model";
322 pub const DEFAULT_MODEL: &str = "small";
324 pub const MODEL_SIZES: &[&str] = &["tiny", "base", "small", "medium", "large"];
326 pub const MODEL_URL_TEMPLATE: &str =
328 "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-{}.bin";
329 pub const MODEL_FILE_TEMPLATE: &str = "ggml-{}.bin";
331 pub const SAMPLE_RATE: u32 = 16000;
333 pub const ACTION_DOWNLOAD: &str = "download";
335 pub const STREAMING_INTERVAL_SECS: u64 = 3;
337 pub const MIN_AUDIO_SECS: u64 = 1;
339 pub const MODEL_PRIORITY: &[&str] = &["large", "medium", "small", "base", "tiny"];
341}
342
343pub mod shell {
344 pub const BASH_PATH: &str = "/bin/bash";
345 pub const WINDOWS_CMD: &str = "cmd";
346 pub const WINDOWS_CMD_FLAG: &str = "/c";
347 pub const BASH_CMD_FLAG: &str = "-c";
348 pub const WINDOWS_OS: &str = "windows";
349 pub const MACOS_OS: &str = "macos";
350}
351
352pub mod todo_filter {
356 pub const ALL: usize = 0;
358 pub const UNDONE: usize = 1;
360 pub const DONE: usize = 2;
362 pub const COUNT: usize = 3;
364
365 pub fn label(filter: usize) -> &'static str {
367 match filter {
368 UNDONE => "未完成",
369 DONE => "已完成",
370 _ => "全部",
371 }
372 }
373
374 pub const DEFAULT: usize = UNDONE;
376}