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 "stream_mode",
24 "max_history_messages",
25 "theme",
26 "tools_enabled",
27];
28
29pub const TOAST_DURATION_SECS: u64 = 4;
31
32pub mod section {
36 pub const PATH: &str = "path";
37 pub const INNER_URL: &str = "inner_url";
38 pub const OUTER_URL: &str = "outer_url";
39 pub const EDITOR: &str = "editor";
40 pub const BROWSER: &str = "browser";
41 pub const VPN: &str = "vpn";
42 pub const SCRIPT: &str = "script";
43 pub const VERSION: &str = "version";
44 pub const SETTING: &str = "setting";
45 pub const LOG: &str = "log";
46 pub const REPORT: &str = "report";
47}
48
49pub const ALL_SECTIONS: &[&str] = &[
51 section::PATH,
52 section::INNER_URL,
53 section::OUTER_URL,
54 section::EDITOR,
55 section::BROWSER,
56 section::VPN,
57 section::SCRIPT,
58 section::VERSION,
59 section::SETTING,
60 section::LOG,
61 section::REPORT,
62];
63
64pub const DEFAULT_DISPLAY_SECTIONS: &[&str] = &[
66 section::PATH,
67 section::INNER_URL,
68 section::OUTER_URL,
69 section::EDITOR,
70 section::BROWSER,
71 section::VPN,
72 section::SCRIPT,
73];
74
75pub const CONTAIN_SEARCH_SECTIONS: &[&str] = &[
77 section::PATH,
78 section::SCRIPT,
79 section::BROWSER,
80 section::EDITOR,
81 section::VPN,
82 section::INNER_URL,
83 section::OUTER_URL,
84];
85
86pub const NOTE_CATEGORIES: &[&str] = &[
90 section::BROWSER,
91 section::EDITOR,
92 section::VPN,
93 section::OUTER_URL,
94 section::SCRIPT,
95];
96
97pub const ALIAS_PATH_SECTIONS: &[&str] = &[section::PATH, section::INNER_URL, section::OUTER_URL];
101
102pub const ALIAS_EXISTS_SECTIONS: &[&str] = &[
104 section::PATH,
105 section::INNER_URL,
106 section::OUTER_URL,
107 section::SCRIPT,
108 section::BROWSER,
109 section::EDITOR,
110 section::VPN,
111];
112
113pub const MODIFY_SECTIONS: &[&str] = &[
115 section::PATH,
116 section::INNER_URL,
117 section::OUTER_URL,
118 section::EDITOR,
119 section::BROWSER,
120 section::VPN,
121];
122
123pub const REMOVE_CLEANUP_SECTIONS: &[&str] = &[
125 section::EDITOR,
126 section::VPN,
127 section::BROWSER,
128 section::SCRIPT,
129];
130
131pub const RENAME_SYNC_SECTIONS: &[&str] = &[
133 section::BROWSER,
134 section::EDITOR,
135 section::VPN,
136 section::SCRIPT,
137];
138
139pub mod config_key {
143 pub const MODE: &str = "mode";
144 pub const VERBOSE: &str = "verbose";
145 pub const CONCISE: &str = "concise";
146 pub const SEARCH_ENGINE: &str = "search-engine";
147 pub const WEEK_REPORT: &str = "week_report";
148 pub const WEEK_NUM: &str = "week_num";
149 pub const LAST_DAY: &str = "last_day";
150 pub const GIT_REPO: &str = "git_repo";
151}
152
153pub const DEFAULT_SEARCH_ENGINE: &str = "bing";
157
158pub mod search_engine {
160 pub const GOOGLE: &str = "https://www.google.com/search?q={}";
161 pub const BING: &str = "https://www.bing.com/search?q={}";
162 pub const BAIDU: &str = "https://www.baidu.com/s?wd={}";
163}
164
165pub const REPORT_DATE_FORMAT: &str = "%Y.%m.%d";
169
170pub const REPORT_SIMPLE_DATE_FORMAT: &str = "%Y/%m/%d";
172
173pub const DEFAULT_CHECK_LINES: usize = 10;
175
176pub mod cmd {
181 pub const SET: &[&str] = &["set", "s"];
183 pub const REMOVE: &[&str] = &["rm", "remove"];
184 pub const RENAME: &[&str] = &["rename", "rn"];
185 pub const MODIFY: &[&str] = &["mf", "modify"];
186
187 pub const NOTE: &[&str] = &["note", "nt"];
189 pub const DENOTE: &[&str] = &["denote", "dnt"];
190
191 pub const LIST: &[&str] = &["ls", "list"];
193 pub const CONTAIN: &[&str] = &["contain", "find"];
194
195 pub const REPORT: &[&str] = &["report", "r"];
197 pub const REPORTCTL: &[&str] = &["reportctl", "rctl"];
198 pub const CHECK: &[&str] = &["check", "c"];
199 pub const SEARCH: &[&str] = &["search", "select", "look", "sch"];
200
201 pub const TODO: &[&str] = &["todo", "td"];
203
204 pub const CONCAT: &[&str] = &["concat"];
206
207 pub const TIME: &[&str] = &["time"];
209
210 pub const LOG: &[&str] = &["log"];
212 pub const CHANGE: &[&str] = &["change", "chg"];
213 pub const CLEAR: &[&str] = &["clear", "cls"];
214
215 pub const VERSION: &[&str] = &["version", "v"];
217 pub const HELP: &[&str] = &["help", "h"];
218 pub const EXIT: &[&str] = &["exit", "q", "quit"];
219
220 pub const COMPLETION: &[&str] = &["completion"];
222
223 pub const CHAT: &[&str] = &["chat", "ai"];
225
226 pub const VOICE: &[&str] = &["voice", "vc"];
228
229 pub const AGENT: &[&str] = &["agent"];
231 pub const SYSTEM: &[&str] = &["system", "ps"];
232
233 pub fn all_keywords() -> Vec<&'static str> {
235 let groups: &[&[&str]] = &[
236 SET, REMOVE, RENAME, MODIFY, NOTE, DENOTE, LIST, CONTAIN, REPORT, REPORTCTL, CHECK,
237 SEARCH, TODO, CHAT, CONCAT, TIME, LOG, CHANGE, CLEAR, VERSION, HELP, EXIT, COMPLETION,
238 VOICE, AGENT, SYSTEM,
239 ];
240 groups.iter().flat_map(|g| g.iter().copied()).collect()
241 }
242}
243
244pub mod rmeta_action {
247 pub const NEW: &str = "new";
248 pub const SYNC: &str = "sync";
249 pub const PUSH: &str = "push";
250 pub const PULL: &str = "pull";
251 pub const SET_URL: &str = "set-url";
252 pub const OPEN: &str = "open";
253}
254
255pub mod time_function {
258 pub const COUNTDOWN: &str = "countdown";
259}
260
261pub mod search_flag {
264 pub const FUZZY_SHORT: &str = "-f";
265 pub const FUZZY: &str = "-fuzzy";
266}
267
268pub const LIST_ALL: &str = "all";
271
272pub const WELCOME_MESSAGE: &str = "Welcome to use j-cli 🚀 ~";
276
277pub const SHELL_PREFIX: char = '!';
279
280pub const INTERACTIVE_PROMPT: &str = "j >";
282
283pub const HISTORY_FILE: &str = "history.txt";
285
286pub const CONFIG_FILE: &str = "config.yaml";
288
289pub const SCRIPTS_DIR: &str = "scripts";
291
292pub const REPORT_DIR: &str = "report";
294
295pub const AGENT_DIR: &str = "agent";
297
298pub const AGENT_LOG_DIR: &str = "logs";
300
301pub const REPORT_DEFAULT_FILE: &str = "week_report.md";
303
304pub const DATA_DIR: &str = ".jdata";
306
307pub const DATA_PATH_ENV: &str = "J_DATA_PATH";
309
310pub mod voice {
316 pub const VOICE_DIR: &str = "voice";
318 pub const MODEL_DIR: &str = "model";
320 pub const DEFAULT_MODEL: &str = "small";
322 pub const MODEL_SIZES: &[&str] = &["tiny", "base", "small", "medium", "large"];
324 pub const MODEL_URL_TEMPLATE: &str =
326 "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-{}.bin";
327 pub const MODEL_FILE_TEMPLATE: &str = "ggml-{}.bin";
329 pub const SAMPLE_RATE: u32 = 16000;
331 pub const ACTION_DOWNLOAD: &str = "download";
333 pub const STREAMING_INTERVAL_SECS: u64 = 3;
335 pub const MIN_AUDIO_SECS: u64 = 1;
337 pub const MODEL_PRIORITY: &[&str] = &["large", "medium", "small", "base", "tiny"];
339}
340
341pub mod shell {
342 pub const BASH_PATH: &str = "/bin/bash";
343 pub const WINDOWS_CMD: &str = "cmd";
344 pub const WINDOWS_CMD_FLAG: &str = "/c";
345 pub const BASH_CMD_FLAG: &str = "-c";
346 pub const WINDOWS_OS: &str = "windows";
347 pub const MACOS_OS: &str = "macos";
348}
349
350pub mod todo_filter {
354 pub const ALL: usize = 0;
356 pub const UNDONE: usize = 1;
358 pub const DONE: usize = 2;
360 pub const COUNT: usize = 3;
362
363 pub fn label(filter: usize) -> &'static str {
365 match filter {
366 UNDONE => "未完成",
367 DONE => "已完成",
368 _ => "全部",
369 }
370 }
371
372 pub const DEFAULT: usize = UNDONE;
374}