修复 i18n
This commit is contained in:
@@ -3,98 +3,97 @@
|
||||
|
||||
mod checkpoint;
|
||||
mod claude_binary;
|
||||
mod commands;
|
||||
mod process;
|
||||
mod i18n;
|
||||
mod claude_config;
|
||||
mod commands;
|
||||
mod file_watcher;
|
||||
mod i18n;
|
||||
mod process;
|
||||
|
||||
use checkpoint::state::CheckpointState;
|
||||
use commands::agents::{
|
||||
cleanup_finished_processes, create_agent, delete_agent, execute_agent, export_agent,
|
||||
export_agent_to_file, fetch_github_agent_content, fetch_github_agents, get_agent,
|
||||
get_agent_run, get_agent_run_with_real_time_metrics, get_claude_binary_path,
|
||||
get_live_session_output, get_session_output, get_session_status, import_agent,
|
||||
import_agent_from_file, import_agent_from_github, init_database, kill_agent_session,
|
||||
list_agent_runs, list_agent_runs_with_metrics, list_agents, list_claude_installations,
|
||||
list_running_sessions, load_agent_session_history, set_claude_binary_path, stream_session_output, update_agent, AgentDb,
|
||||
get_model_mappings, update_model_mapping,
|
||||
get_live_session_output, get_model_mappings, get_session_output, get_session_status,
|
||||
import_agent, import_agent_from_file, import_agent_from_github, init_database,
|
||||
kill_agent_session, list_agent_runs, list_agent_runs_with_metrics, list_agents,
|
||||
list_claude_installations, list_running_sessions, load_agent_session_history,
|
||||
set_claude_binary_path, stream_session_output, update_agent, update_model_mapping, AgentDb,
|
||||
};
|
||||
use commands::claude::{
|
||||
cancel_claude_execution, check_auto_checkpoint, check_claude_version, cleanup_old_checkpoints,
|
||||
clear_checkpoint_manager, continue_claude_code, create_checkpoint, execute_claude_code,
|
||||
find_claude_md_files, fork_from_checkpoint, get_checkpoint_diff, get_checkpoint_settings,
|
||||
get_checkpoint_state_stats, get_claude_session_output, get_claude_settings, get_project_sessions,
|
||||
get_recently_modified_files, get_session_timeline, get_system_prompt, list_checkpoints,
|
||||
list_directory_contents, list_projects, list_running_claude_sessions, load_session_history,
|
||||
open_new_session, read_claude_md_file, restore_checkpoint, resume_claude_code,
|
||||
save_claude_md_file, save_claude_settings, save_system_prompt, search_files,
|
||||
track_checkpoint_message, track_session_messages, update_checkpoint_settings,
|
||||
get_hooks_config, update_hooks_config, validate_hook_command,
|
||||
watch_claude_project_directory, unwatch_claude_project_directory,
|
||||
ClaudeProcessState,
|
||||
get_checkpoint_state_stats, get_claude_session_output, get_claude_settings, get_hooks_config,
|
||||
get_project_sessions, get_recently_modified_files, get_session_timeline, get_system_prompt,
|
||||
list_checkpoints, list_directory_contents, list_projects, list_running_claude_sessions,
|
||||
load_session_history, open_new_session, read_claude_md_file, restore_checkpoint,
|
||||
resume_claude_code, save_claude_md_file, save_claude_settings, save_system_prompt,
|
||||
search_files, track_checkpoint_message, track_session_messages,
|
||||
unwatch_claude_project_directory, update_checkpoint_settings, update_hooks_config,
|
||||
validate_hook_command, watch_claude_project_directory, ClaudeProcessState,
|
||||
};
|
||||
use commands::mcp::{
|
||||
mcp_add, mcp_add_from_claude_desktop, mcp_add_json, mcp_get, mcp_get_server_status, mcp_list,
|
||||
mcp_read_project_config, mcp_remove, mcp_reset_project_choices, mcp_save_project_config,
|
||||
mcp_serve, mcp_test_connection, mcp_export_servers,
|
||||
mcp_add, mcp_add_from_claude_desktop, mcp_add_json, mcp_export_servers, mcp_get,
|
||||
mcp_get_server_status, mcp_list, mcp_read_project_config, mcp_remove,
|
||||
mcp_reset_project_choices, mcp_save_project_config, mcp_serve, mcp_test_connection,
|
||||
};
|
||||
|
||||
use commands::ccr::{
|
||||
check_ccr_installation, get_ccr_config_path, get_ccr_service_status, get_ccr_version,
|
||||
open_ccr_ui, restart_ccr_service, start_ccr_service, stop_ccr_service,
|
||||
};
|
||||
use commands::filesystem::{
|
||||
get_file_info, get_file_tree, get_watched_paths, read_directory_tree, read_file,
|
||||
search_files_by_name, unwatch_directory, watch_directory, write_file,
|
||||
};
|
||||
use commands::git::{
|
||||
get_git_branches, get_git_commits, get_git_diff, get_git_history, get_git_status,
|
||||
};
|
||||
use commands::language::{get_current_language, get_supported_languages, set_language};
|
||||
use commands::packycode_nodes::{
|
||||
auto_select_best_node, get_packycode_nodes, test_all_packycode_nodes,
|
||||
};
|
||||
use commands::proxy::{apply_proxy_settings, get_proxy_settings, save_proxy_settings};
|
||||
use commands::relay_adapters::{
|
||||
packycode_get_user_quota, relay_station_create_token, relay_station_delete_token,
|
||||
relay_station_get_info, relay_station_get_usage_logs, relay_station_get_user_info,
|
||||
relay_station_list_tokens, relay_station_test_connection, relay_station_update_token,
|
||||
};
|
||||
use commands::relay_stations::{
|
||||
relay_station_create, relay_station_delete, relay_station_get,
|
||||
relay_station_get_current_config, relay_station_restore_config, relay_station_sync_config,
|
||||
relay_station_toggle_enable, relay_station_update, relay_station_update_order,
|
||||
relay_stations_export, relay_stations_import, relay_stations_list,
|
||||
};
|
||||
use commands::smart_sessions::{
|
||||
cleanup_old_smart_sessions_command, create_smart_quick_start_session, get_smart_session_config,
|
||||
list_smart_sessions_command, toggle_smart_session_mode, update_smart_session_config,
|
||||
};
|
||||
use commands::storage::{
|
||||
storage_delete_row, storage_execute_sql, storage_insert_row, storage_list_tables,
|
||||
storage_read_table, storage_reset_database, storage_update_row,
|
||||
};
|
||||
use commands::system::flush_dns;
|
||||
use commands::terminal::{
|
||||
cleanup_terminal_sessions, close_terminal_session, create_terminal_session,
|
||||
list_terminal_sessions, resize_terminal, send_terminal_input, TerminalState,
|
||||
};
|
||||
use commands::usage::{
|
||||
get_session_stats, get_usage_by_date_range, get_usage_details, get_usage_stats,
|
||||
};
|
||||
use commands::usage_cache::{
|
||||
usage_check_updates, usage_clear_cache, usage_force_scan, usage_get_stats_cached,
|
||||
usage_scan_update, UsageCacheState,
|
||||
};
|
||||
use commands::usage_index::{
|
||||
usage_get_summary, usage_import_diffs, usage_scan_index, usage_scan_progress, UsageIndexState,
|
||||
};
|
||||
use commands::usage_cache::{
|
||||
usage_scan_update, usage_get_stats_cached, usage_clear_cache, usage_force_scan, usage_check_updates, UsageCacheState,
|
||||
};
|
||||
use commands::storage::{
|
||||
storage_list_tables, storage_read_table, storage_update_row, storage_delete_row,
|
||||
storage_insert_row, storage_execute_sql, storage_reset_database,
|
||||
};
|
||||
use commands::proxy::{get_proxy_settings, save_proxy_settings, apply_proxy_settings};
|
||||
use commands::language::{get_current_language, set_language, get_supported_languages};
|
||||
use commands::relay_stations::{
|
||||
relay_stations_list, relay_station_get, relay_station_create, relay_station_update,
|
||||
relay_station_delete, relay_station_toggle_enable, relay_station_sync_config,
|
||||
relay_station_restore_config, relay_station_get_current_config,
|
||||
relay_stations_export, relay_stations_import, relay_station_update_order,
|
||||
};
|
||||
use commands::relay_adapters::{
|
||||
relay_station_get_info, relay_station_get_user_info,
|
||||
relay_station_test_connection, relay_station_get_usage_logs, relay_station_list_tokens,
|
||||
relay_station_create_token, relay_station_update_token, relay_station_delete_token,
|
||||
packycode_get_user_quota,
|
||||
};
|
||||
use commands::packycode_nodes::{
|
||||
test_all_packycode_nodes, auto_select_best_node, get_packycode_nodes,
|
||||
};
|
||||
use commands::filesystem::{
|
||||
read_directory_tree, search_files_by_name, get_file_info, watch_directory,
|
||||
read_file, write_file, get_file_tree, unwatch_directory, get_watched_paths,
|
||||
};
|
||||
use commands::git::{
|
||||
get_git_status, get_git_history, get_git_branches, get_git_diff, get_git_commits,
|
||||
};
|
||||
use commands::terminal::{
|
||||
create_terminal_session, send_terminal_input, close_terminal_session,
|
||||
list_terminal_sessions, resize_terminal, cleanup_terminal_sessions, TerminalState,
|
||||
};
|
||||
use commands::ccr::{
|
||||
check_ccr_installation, get_ccr_version, get_ccr_service_status, start_ccr_service,
|
||||
stop_ccr_service, restart_ccr_service, open_ccr_ui, get_ccr_config_path,
|
||||
};
|
||||
use commands::system::flush_dns;
|
||||
use commands::smart_sessions::{
|
||||
create_smart_quick_start_session, get_smart_session_config, update_smart_session_config,
|
||||
list_smart_sessions_command, toggle_smart_session_mode, cleanup_old_smart_sessions_command,
|
||||
};
|
||||
use process::ProcessRegistryState;
|
||||
use file_watcher::FileWatcherState;
|
||||
use process::ProcessRegistryState;
|
||||
use std::sync::Mutex;
|
||||
use tauri::Manager;
|
||||
use tauri::menu::{MenuBuilder, MenuItemBuilder, SubmenuBuilder};
|
||||
use tauri::Manager;
|
||||
use tauri_plugin_log::{Target, TargetKind};
|
||||
|
||||
fn main() {
|
||||
@@ -105,30 +104,34 @@ fn main() {
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_fs::init())
|
||||
.plugin(tauri_plugin_clipboard_manager::init())
|
||||
.plugin(tauri_plugin_log::Builder::new()
|
||||
.level(log::LevelFilter::Debug)
|
||||
.targets([
|
||||
Target::new(TargetKind::LogDir { file_name: None }),
|
||||
Target::new(TargetKind::Stdout),
|
||||
])
|
||||
.build())
|
||||
.plugin(
|
||||
tauri_plugin_log::Builder::new()
|
||||
.level(log::LevelFilter::Debug)
|
||||
.targets([
|
||||
Target::new(TargetKind::LogDir { file_name: None }),
|
||||
Target::new(TargetKind::Stdout),
|
||||
])
|
||||
.build(),
|
||||
)
|
||||
// App menu: include standard Edit actions so OS hotkeys (Undo/Redo/Cut/Copy/Paste/Select All)
|
||||
// work across all pages, plus a DevTools toggle.
|
||||
.menu(|app| {
|
||||
#[cfg(target_os = "macos")]
|
||||
{
|
||||
use tauri::menu::AboutMetadataBuilder;
|
||||
|
||||
|
||||
// Create macOS app menu with Quit
|
||||
let app_menu = SubmenuBuilder::new(app, "Claudia")
|
||||
.about(Some(AboutMetadataBuilder::new()
|
||||
.version(Some(env!("CARGO_PKG_VERSION")))
|
||||
.build()))
|
||||
.about(Some(
|
||||
AboutMetadataBuilder::new()
|
||||
.version(Some(env!("CARGO_PKG_VERSION")))
|
||||
.build(),
|
||||
))
|
||||
.separator()
|
||||
.quit()
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
|
||||
let edit_menu = SubmenuBuilder::new(app, "Edit")
|
||||
.undo()
|
||||
.redo()
|
||||
@@ -139,26 +142,28 @@ fn main() {
|
||||
.select_all()
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
|
||||
let window_menu = SubmenuBuilder::new(app, "Window")
|
||||
.close_window()
|
||||
.minimize()
|
||||
.separator()
|
||||
.item(&MenuItemBuilder::new("Toggle DevTools")
|
||||
.id("toggle-devtools")
|
||||
.accelerator("CmdOrCtrl+Alt+I")
|
||||
.build(app)
|
||||
.unwrap())
|
||||
.item(
|
||||
&MenuItemBuilder::new("Toggle DevTools")
|
||||
.id("toggle-devtools")
|
||||
.accelerator("CmdOrCtrl+Alt+I")
|
||||
.build(app)
|
||||
.unwrap(),
|
||||
)
|
||||
.build()
|
||||
.unwrap();
|
||||
|
||||
|
||||
MenuBuilder::new(app)
|
||||
.item(&app_menu)
|
||||
.item(&edit_menu)
|
||||
.item(&window_menu)
|
||||
.build()
|
||||
}
|
||||
|
||||
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
{
|
||||
let toggle_devtools = MenuItemBuilder::new("Toggle DevTools")
|
||||
@@ -166,19 +171,19 @@ fn main() {
|
||||
.accelerator("CmdOrCtrl+Alt+I")
|
||||
.build(app)
|
||||
.unwrap();
|
||||
|
||||
|
||||
let close_window = MenuItemBuilder::new("Close Window")
|
||||
.id("close-window")
|
||||
.accelerator("CmdOrCtrl+W")
|
||||
.build(app)
|
||||
.unwrap();
|
||||
|
||||
|
||||
let quit = MenuItemBuilder::new("Quit")
|
||||
.id("quit")
|
||||
.accelerator("CmdOrCtrl+Q")
|
||||
.build(app)
|
||||
.unwrap();
|
||||
|
||||
|
||||
let edit_menu = SubmenuBuilder::new(app, "Edit")
|
||||
.undo()
|
||||
.redo()
|
||||
@@ -211,7 +216,7 @@ fn main() {
|
||||
.setup(|app| {
|
||||
// Initialize agents database
|
||||
let conn = init_database(&app.handle()).expect("Failed to initialize agents database");
|
||||
|
||||
|
||||
// Load and apply proxy settings from the database
|
||||
{
|
||||
let db = AgentDb(Mutex::new(conn));
|
||||
@@ -219,7 +224,7 @@ fn main() {
|
||||
Ok(conn) => {
|
||||
// Directly query proxy settings from the database
|
||||
let mut settings = commands::proxy::ProxySettings::default();
|
||||
|
||||
|
||||
let keys = vec![
|
||||
("proxy_enabled", "enabled"),
|
||||
("proxy_http", "http_proxy"),
|
||||
@@ -227,7 +232,7 @@ fn main() {
|
||||
("proxy_no", "no_proxy"),
|
||||
("proxy_all", "all_proxy"),
|
||||
];
|
||||
|
||||
|
||||
for (db_key, field) in keys {
|
||||
if let Ok(value) = conn.query_row(
|
||||
"SELECT value FROM app_settings WHERE key = ?1",
|
||||
@@ -236,15 +241,23 @@ fn main() {
|
||||
) {
|
||||
match field {
|
||||
"enabled" => settings.enabled = value == "true",
|
||||
"http_proxy" => settings.http_proxy = Some(value).filter(|s| !s.is_empty()),
|
||||
"https_proxy" => settings.https_proxy = Some(value).filter(|s| !s.is_empty()),
|
||||
"no_proxy" => settings.no_proxy = Some(value).filter(|s| !s.is_empty()),
|
||||
"all_proxy" => settings.all_proxy = Some(value).filter(|s| !s.is_empty()),
|
||||
"http_proxy" => {
|
||||
settings.http_proxy = Some(value).filter(|s| !s.is_empty())
|
||||
}
|
||||
"https_proxy" => {
|
||||
settings.https_proxy = Some(value).filter(|s| !s.is_empty())
|
||||
}
|
||||
"no_proxy" => {
|
||||
settings.no_proxy = Some(value).filter(|s| !s.is_empty())
|
||||
}
|
||||
"all_proxy" => {
|
||||
settings.all_proxy = Some(value).filter(|s| !s.is_empty())
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
log::info!("Loaded proxy settings: enabled={}", settings.enabled);
|
||||
settings
|
||||
}
|
||||
@@ -253,11 +266,11 @@ fn main() {
|
||||
commands::proxy::ProxySettings::default()
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Apply the proxy settings
|
||||
apply_proxy_settings(&proxy_settings);
|
||||
}
|
||||
|
||||
|
||||
// Re-open the connection for the app to manage
|
||||
let conn = init_database(&app.handle()).expect("Failed to initialize agents database");
|
||||
app.manage(AgentDb(Mutex::new(conn)));
|
||||
@@ -285,7 +298,7 @@ fn main() {
|
||||
|
||||
// Initialize process registry
|
||||
app.manage(ProcessRegistryState::default());
|
||||
|
||||
|
||||
// Initialize file watcher state
|
||||
let file_watcher_state = FileWatcherState::new();
|
||||
file_watcher_state.init(app.handle().clone());
|
||||
@@ -337,7 +350,6 @@ fn main() {
|
||||
get_hooks_config,
|
||||
update_hooks_config,
|
||||
validate_hook_command,
|
||||
|
||||
// Checkpoint Management
|
||||
create_checkpoint,
|
||||
restore_checkpoint,
|
||||
@@ -353,7 +365,6 @@ fn main() {
|
||||
get_checkpoint_settings,
|
||||
clear_checkpoint_manager,
|
||||
get_checkpoint_state_stats,
|
||||
|
||||
// Agent Management
|
||||
list_agents,
|
||||
create_agent,
|
||||
@@ -385,26 +396,22 @@ fn main() {
|
||||
import_agent_from_github,
|
||||
get_model_mappings,
|
||||
update_model_mapping,
|
||||
|
||||
// Usage & Analytics
|
||||
get_usage_stats,
|
||||
get_usage_by_date_range,
|
||||
get_usage_details,
|
||||
get_session_stats,
|
||||
|
||||
// File Usage Index (SQLite)
|
||||
usage_scan_index,
|
||||
usage_scan_progress,
|
||||
usage_get_summary,
|
||||
usage_import_diffs,
|
||||
|
||||
// Usage Cache Management
|
||||
usage_scan_update,
|
||||
usage_get_stats_cached,
|
||||
usage_clear_cache,
|
||||
usage_force_scan,
|
||||
usage_check_updates,
|
||||
|
||||
// MCP (Model Context Protocol)
|
||||
mcp_add,
|
||||
mcp_list,
|
||||
@@ -419,7 +426,6 @@ fn main() {
|
||||
mcp_read_project_config,
|
||||
mcp_save_project_config,
|
||||
mcp_export_servers,
|
||||
|
||||
// Storage Management
|
||||
storage_list_tables,
|
||||
storage_read_table,
|
||||
@@ -428,7 +434,6 @@ fn main() {
|
||||
storage_insert_row,
|
||||
storage_execute_sql,
|
||||
storage_reset_database,
|
||||
|
||||
// Smart Sessions Management
|
||||
create_smart_quick_start_session,
|
||||
get_smart_session_config,
|
||||
@@ -436,22 +441,18 @@ fn main() {
|
||||
list_smart_sessions_command,
|
||||
toggle_smart_session_mode,
|
||||
cleanup_old_smart_sessions_command,
|
||||
|
||||
// Slash Commands
|
||||
commands::slash_commands::slash_commands_list,
|
||||
commands::slash_commands::slash_command_get,
|
||||
commands::slash_commands::slash_command_save,
|
||||
commands::slash_commands::slash_command_delete,
|
||||
|
||||
// Proxy Settings
|
||||
get_proxy_settings,
|
||||
save_proxy_settings,
|
||||
|
||||
// Language Settings
|
||||
get_current_language,
|
||||
set_language,
|
||||
get_supported_languages,
|
||||
|
||||
// Relay Stations
|
||||
relay_stations_list,
|
||||
relay_station_get,
|
||||
@@ -474,12 +475,10 @@ fn main() {
|
||||
relay_station_update_token,
|
||||
relay_station_delete_token,
|
||||
packycode_get_user_quota,
|
||||
|
||||
// PackyCode Nodes
|
||||
test_all_packycode_nodes,
|
||||
auto_select_best_node,
|
||||
get_packycode_nodes,
|
||||
|
||||
// File System
|
||||
read_directory_tree,
|
||||
search_files_by_name,
|
||||
@@ -490,14 +489,12 @@ fn main() {
|
||||
read_file,
|
||||
write_file,
|
||||
get_file_tree,
|
||||
|
||||
// Git
|
||||
get_git_status,
|
||||
get_git_history,
|
||||
get_git_branches,
|
||||
get_git_diff,
|
||||
get_git_commits,
|
||||
|
||||
// Terminal
|
||||
create_terminal_session,
|
||||
send_terminal_input,
|
||||
@@ -505,7 +502,6 @@ fn main() {
|
||||
list_terminal_sessions,
|
||||
resize_terminal,
|
||||
cleanup_terminal_sessions,
|
||||
|
||||
// CCR (Claude Code Router)
|
||||
check_ccr_installation,
|
||||
get_ccr_version,
|
||||
@@ -515,7 +511,6 @@ fn main() {
|
||||
restart_ccr_service,
|
||||
open_ccr_ui,
|
||||
get_ccr_config_path,
|
||||
|
||||
// System utilities
|
||||
flush_dns,
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user