后端代码优化
This commit is contained in:
@@ -8,13 +8,16 @@ use tauri::State;
|
||||
|
||||
use crate::acp::binary_cache;
|
||||
use crate::acp::error::AcpError;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::acp::manager::ConnectionManager;
|
||||
use crate::acp::preflight::{self, PreflightResult};
|
||||
use crate::acp::registry;
|
||||
use crate::acp::types::{
|
||||
AcpAgentInfo, AgentSkillContent, AgentSkillItem, AgentSkillLayout, AgentSkillLocation,
|
||||
AgentSkillScope, AgentSkillsListResult, ConnectionInfo, ForkResultInfo, PromptInputBlock,
|
||||
AgentSkillScope, AgentSkillsListResult,
|
||||
};
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::acp::types::{ConnectionInfo, ForkResultInfo, PromptInputBlock};
|
||||
use crate::db::service::agent_setting_service;
|
||||
use crate::db::AppDatabase;
|
||||
use crate::models::agent::AgentType;
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
use std::collections::{HashMap, HashSet};
|
||||
|
||||
use crate::app_error::AppCommandError;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::db::entities::conversation;
|
||||
use crate::db::service::{conversation_service, folder_service, import_service};
|
||||
use crate::db::service::{conversation_service, folder_service};
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::db::service::import_service;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::db::AppDatabase;
|
||||
use crate::models::*;
|
||||
use crate::parsers::claude::ClaudeParser;
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::db::error::DbError;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::db::service::folder_command_service;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::db::AppDatabase;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::models::FolderCommandInfo;
|
||||
use std::path::Path;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use tokio::sync::Mutex;
|
||||
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
static BOOTSTRAP_FOLDER_COMMANDS_LOCK: Mutex<()> = Mutex::const_new(());
|
||||
|
||||
pub(crate) fn load_package_scripts_as_commands(folder_path: &str) -> Vec<(String, String)> {
|
||||
|
||||
@@ -18,10 +18,13 @@ use walkdir::WalkDir;
|
||||
use tauri::Manager;
|
||||
|
||||
use crate::app_error::AppCommandError;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::db::error::DbError;
|
||||
use crate::db::service::folder_service;
|
||||
use crate::db::AppDatabase;
|
||||
use crate::models::{FolderDetail, FolderHistoryEntry, GitCredentials, OpenedConversation};
|
||||
use crate::models::GitCredentials;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::models::{FolderDetail, FolderHistoryEntry, OpenedConversation};
|
||||
use crate::web::event_bridge::EventEmitter;
|
||||
|
||||
/// Configure a git command for remote operations:
|
||||
|
||||
@@ -4,12 +4,15 @@ use tauri::State;
|
||||
|
||||
use crate::app_error::AppCommandError;
|
||||
use crate::db::service::app_metadata_service;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::db::AppDatabase;
|
||||
use crate::models::{SystemLanguageSettings, SystemProxySettings};
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::network::proxy;
|
||||
|
||||
const SYSTEM_PROXY_SETTINGS_KEY: &str = "system_proxy_settings";
|
||||
const SYSTEM_LANGUAGE_SETTINGS_KEY: &str = "system_language_settings";
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
const LANGUAGE_SETTINGS_UPDATED_EVENT: &str = "app://language-settings-updated";
|
||||
|
||||
fn normalize_proxy_settings(
|
||||
|
||||
@@ -6,9 +6,13 @@ use tauri::Manager;
|
||||
use tauri::State;
|
||||
|
||||
use crate::git_credential;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::terminal::error::TerminalError;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::terminal::manager::{SpawnOptions, TerminalManager};
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::terminal::types::TerminalInfo;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::web::event_bridge::EventEmitter;
|
||||
|
||||
/// Build extra env vars for the terminal session.
|
||||
|
||||
@@ -4,12 +4,15 @@ use tauri::State;
|
||||
|
||||
use crate::app_error::AppCommandError;
|
||||
use crate::db::service::app_metadata_service;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::db::AppDatabase;
|
||||
use crate::models::{
|
||||
GitDetectResult, GitHubAccountsSettings, GitHubTokenValidation, GitSettings,
|
||||
};
|
||||
use crate::models::GitDetectResult;
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
use crate::models::GitHubAccountsSettings;
|
||||
use crate::models::{GitHubTokenValidation, GitSettings};
|
||||
|
||||
const GIT_SETTINGS_KEY: &str = "git_settings";
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
const GITHUB_ACCOUNTS_KEY: &str = "github_accounts";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -170,6 +173,7 @@ pub async fn update_git_settings(
|
||||
// GitHub accounts
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#[cfg(feature = "tauri-runtime")]
|
||||
async fn load_github_accounts(
|
||||
conn: &sea_orm::DatabaseConnection,
|
||||
) -> Result<GitHubAccountsSettings, AppCommandError> {
|
||||
|
||||
Reference in New Issue
Block a user