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 "max_tool_rounds",
28];
29
30pub const TOAST_DURATION_SECS: u64 = 4;
32
33pub mod section {
37 pub const PATH: &str = "path";
38 pub const INNER_URL: &str = "inner_url";
39 pub const OUTER_URL: &str = "outer_url";
40 pub const EDITOR: &str = "editor";
41 pub const BROWSER: &str = "browser";
42 pub const VPN: &str = "vpn";
43 pub const SCRIPT: &str = "script";
44 pub const VERSION: &str = "version";
45 pub const SETTING: &str = "setting";
46 pub const LOG: &str = "log";
47 pub const REPORT: &str = "report";
48}
49
50pub const ALL_SECTIONS: &[&str] = &[
52 section::PATH,
53 section::INNER_URL,
54 section::OUTER_URL,
55 section::EDITOR,
56 section::BROWSER,
57 section::VPN,
58 section::SCRIPT,
59 section::VERSION,
60 section::SETTING,
61 section::LOG,
62 section::REPORT,
63];
64
65pub const DEFAULT_DISPLAY_SECTIONS: &[&str] = &[
67 section::PATH,
68 section::INNER_URL,
69 section::OUTER_URL,
70 section::EDITOR,
71 section::BROWSER,
72 section::VPN,
73 section::SCRIPT,
74];
75
76pub const CONTAIN_SEARCH_SECTIONS: &[&str] = &[
78 section::PATH,
79 section::SCRIPT,
80 section::BROWSER,
81 section::EDITOR,
82 section::VPN,
83 section::INNER_URL,
84 section::OUTER_URL,
85];
86
87pub const NOTE_CATEGORIES: &[&str] = &[
91 section::BROWSER,
92 section::EDITOR,
93 section::VPN,
94 section::OUTER_URL,
95 section::SCRIPT,
96];
97
98pub const ALIAS_PATH_SECTIONS: &[&str] = &[section::PATH, section::INNER_URL, section::OUTER_URL];
102
103pub const ALIAS_EXISTS_SECTIONS: &[&str] = &[
105 section::PATH,
106 section::INNER_URL,
107 section::OUTER_URL,
108 section::SCRIPT,
109 section::BROWSER,
110 section::EDITOR,
111 section::VPN,
112];
113
114pub const MODIFY_SECTIONS: &[&str] = &[
116 section::PATH,
117 section::INNER_URL,
118 section::OUTER_URL,
119 section::EDITOR,
120 section::BROWSER,
121 section::VPN,
122];
123
124pub const REMOVE_CLEANUP_SECTIONS: &[&str] = &[
126 section::EDITOR,
127 section::VPN,
128 section::BROWSER,
129 section::SCRIPT,
130];
131
132pub const RENAME_SYNC_SECTIONS: &[&str] = &[
134 section::BROWSER,
135 section::EDITOR,
136 section::VPN,
137 section::SCRIPT,
138];
139
140pub mod config_key {
144 pub const MODE: &str = "mode";
145 pub const VERBOSE: &str = "verbose";
146 pub const CONCISE: &str = "concise";
147 pub const SEARCH_ENGINE: &str = "search-engine";
148 pub const WEEK_REPORT: &str = "week_report";
149 pub const WEEK_NUM: &str = "week_num";
150 pub const LAST_DAY: &str = "last_day";
151 pub const GIT_REPO: &str = "git_repo";
152}
153
154pub const DEFAULT_SEARCH_ENGINE: &str = "bing";
158
159pub mod search_engine {
161 pub const GOOGLE: &str = "https://www.google.com/search?q={}";
162 pub const BING: &str = "https://www.bing.com/search?q={}";
163 pub const BAIDU: &str = "https://www.baidu.com/s?wd={}";
164}
165
166pub const REPORT_DATE_FORMAT: &str = "%Y.%m.%d";
170
171pub const REPORT_SIMPLE_DATE_FORMAT: &str = "%Y/%m/%d";
173
174pub const DEFAULT_CHECK_LINES: usize = 10;
176
177pub mod cmd {
182 pub const SET: &[&str] = &["set", "s"];
184 pub const REMOVE: &[&str] = &["rm", "remove"];
185 pub const RENAME: &[&str] = &["rename", "rn"];
186 pub const MODIFY: &[&str] = &["mf", "modify"];
187
188 pub const NOTE: &[&str] = &["note", "nt"];
190 pub const DENOTE: &[&str] = &["denote", "dnt"];
191
192 pub const LIST: &[&str] = &["ls", "list"];
194 pub const CONTAIN: &[&str] = &["contain", "find"];
195
196 pub const REPORT: &[&str] = &["report", "r"];
198 pub const REPORTCTL: &[&str] = &["reportctl", "rctl"];
199 pub const CHECK: &[&str] = &["check", "c"];
200 pub const SEARCH: &[&str] = &["search", "select", "look", "sch"];
201
202 pub const TODO: &[&str] = &["todo", "td"];
204
205 pub const CONCAT: &[&str] = &["concat"];
207
208 pub const TIME: &[&str] = &["time"];
210
211 pub const LOG: &[&str] = &["log"];
213 pub const CHANGE: &[&str] = &["change", "chg"];
214 pub const CLEAR: &[&str] = &["clear", "cls"];
215
216 pub const VERSION: &[&str] = &["version", "v"];
218 pub const HELP: &[&str] = &["help", "h"];
219 pub const EXIT: &[&str] = &["exit", "q", "quit"];
220
221 pub const COMPLETION: &[&str] = &["completion"];
223
224 pub const CHAT: &[&str] = &["chat", "ai"];
226
227 pub const VOICE: &[&str] = &["voice", "vc"];
229
230 pub const AGENT: &[&str] = &["agent"];
232 pub const SYSTEM: &[&str] = &["system", "ps"];
233
234 pub fn all_keywords() -> Vec<&'static str> {
236 let groups: &[&[&str]] = &[
237 SET, REMOVE, RENAME, MODIFY, NOTE, DENOTE, LIST, CONTAIN, REPORT, REPORTCTL, CHECK,
238 SEARCH, TODO, CHAT, CONCAT, TIME, LOG, CHANGE, CLEAR, VERSION, HELP, EXIT, COMPLETION,
239 VOICE, AGENT, SYSTEM,
240 ];
241 groups.iter().flat_map(|g| g.iter().copied()).collect()
242 }
243}
244
245pub mod rmeta_action {
248 pub const NEW: &str = "new";
249 pub const SYNC: &str = "sync";
250 pub const PUSH: &str = "push";
251 pub const PULL: &str = "pull";
252 pub const SET_URL: &str = "set-url";
253 pub const OPEN: &str = "open";
254}
255
256pub mod time_function {
259 pub const COUNTDOWN: &str = "countdown";
260}
261
262pub mod search_flag {
265 pub const FUZZY_SHORT: &str = "-f";
266 pub const FUZZY: &str = "-fuzzy";
267}
268
269pub const LIST_ALL: &str = "all";
272
273pub const WELCOME_MESSAGE: &str = "Welcome to use j-cli 🚀 ~";
277
278pub const SHELL_PREFIX: char = '!';
280
281pub const INTERACTIVE_PROMPT: &str = "j >";
283
284pub const HISTORY_FILE: &str = "history.txt";
286
287pub const CONFIG_FILE: &str = "config.yaml";
289
290pub const SCRIPTS_DIR: &str = "scripts";
292
293pub const REPORT_DIR: &str = "report";
295
296pub const AGENT_DIR: &str = "agent";
298
299pub const AGENT_LOG_DIR: &str = "logs";
301
302pub const REPORT_DEFAULT_FILE: &str = "week_report.md";
304
305pub const DATA_DIR: &str = ".jdata";
307
308pub const DATA_PATH_ENV: &str = "J_DATA_PATH";
310
311pub mod voice {
317 pub const VOICE_DIR: &str = "voice";
319 pub const MODEL_DIR: &str = "model";
321 pub const DEFAULT_MODEL: &str = "small";
323 pub const MODEL_SIZES: &[&str] = &["tiny", "base", "small", "medium", "large"];
325 pub const MODEL_URL_TEMPLATE: &str =
327 "https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-{}.bin";
328 pub const MODEL_FILE_TEMPLATE: &str = "ggml-{}.bin";
330 pub const SAMPLE_RATE: u32 = 16000;
332 pub const ACTION_DOWNLOAD: &str = "download";
334 pub const STREAMING_INTERVAL_SECS: u64 = 3;
336 pub const MIN_AUDIO_SECS: u64 = 1;
338 pub const MODEL_PRIORITY: &[&str] = &["large", "medium", "small", "base", "tiny"];
340}
341
342pub mod shell {
343 pub const BASH_PATH: &str = "/bin/bash";
344 pub const WINDOWS_CMD: &str = "cmd";
345 pub const WINDOWS_CMD_FLAG: &str = "/c";
346 pub const BASH_CMD_FLAG: &str = "-c";
347 pub const WINDOWS_OS: &str = "windows";
348 pub const MACOS_OS: &str = "macos";
349}
350
351pub mod todo_filter {
355 pub const ALL: usize = 0;
357 pub const UNDONE: usize = 1;
359 pub const DONE: usize = 2;
361 pub const COUNT: usize = 3;
363
364 pub fn label(filter: usize) -> &'static str {
366 match filter {
367 UNDONE => "未完成",
368 DONE => "已完成",
369 _ => "全部",
370 }
371 }
372
373 pub const DEFAULT: usize = UNDONE;
375}