1
This commit is contained in:
@@ -32,9 +32,17 @@ struct Inner {
|
||||
pub struct AppConfig {
|
||||
inner: Arc<RwLock<Inner>>,
|
||||
}
|
||||
|
||||
fn is_dev() -> bool {
|
||||
cfg!(debug_assertions)
|
||||
}
|
||||
pub fn api_base() -> String {
|
||||
std::env::var("AICLIENT_API_BASE").unwrap_or_else(|_| "http://127.0.0.1:8001".to_string())
|
||||
std::env::var("AICLIENT_API_BASE").unwrap_or_else(|_| {
|
||||
if is_dev() {
|
||||
"http://127.0.0.1:8001".to_string()
|
||||
} else {
|
||||
"http://81.71.163.140:8001".to_string()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
/// 将库表 `name` 转为 Node 环境变量名(不含前缀),如 `llm.api_key` → `LLM_API_KEY`。
|
||||
|
||||
@@ -43,9 +43,7 @@ impl From<rquickjs::Error> for JsError {
|
||||
}
|
||||
}
|
||||
|
||||
fn api_base() -> String {
|
||||
std::env::var("AICLIENT_API_BASE").unwrap_or_else(|_| "http://127.0.0.1:8001".to_string())
|
||||
}
|
||||
|
||||
|
||||
async fn fetch_script_source(script_name: &str) -> Result<String, JsError> {
|
||||
let q = urlencoding::encode(script_name);
|
||||
|
||||
@@ -254,12 +254,6 @@ async fn write_script_bundle(
|
||||
Ok((bundle_dir, runner_path))
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// 从后端拉脚本源码
|
||||
// ---------------------------------------------------------------------------
|
||||
fn api_base() -> String {
|
||||
std::env::var("AICLIENT_API_BASE").unwrap_or_else(|_| "http://127.0.0.1:8001".to_string())
|
||||
}
|
||||
|
||||
async fn fetch_node_script_source(script_name: &str) -> Result<String, NodeError> {
|
||||
let q = urlencoding::encode(script_name);
|
||||
|
||||
Reference in New Issue
Block a user