feat: add React UI and AI page sharing tools
Move HTTP page rendering to the React app, fix multi-tool-call message handling, add API docs lookup, web page lookup, and Markdown preview page sharing.
This commit is contained in:
@@ -5,12 +5,25 @@ fn main() {
|
||||
let migrations = Path::new("migrations");
|
||||
println!("cargo:rerun-if-changed={}", migrations.display());
|
||||
|
||||
let mut count = 0u64;
|
||||
if let Ok(entries) = fs::read_dir(migrations) {
|
||||
for entry in entries.flatten() {
|
||||
let path = entry.path();
|
||||
if path.extension().is_some_and(|extension| extension == "sql") {
|
||||
println!("cargo:rerun-if-changed={}", path.display());
|
||||
// 将文件大小加入计数,确保新增/删除/修改文件都改变输出
|
||||
count = count.wrapping_add(fs::metadata(&path).map(|m| m.len()).unwrap_or(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 将 migration 摘要写入 OUT_DIR,lib.rs 通过 include! 引用。
|
||||
// 这样 cargo 可以追踪 migration 变更 → lib.rs 重编译 → sqlx::migrate! 重新展开。
|
||||
let out_dir = std::env::var("OUT_DIR").unwrap();
|
||||
let dest = Path::new(&out_dir).join("migration_stamp.rs");
|
||||
fs::write(
|
||||
&dest,
|
||||
format!("// generated by build.rs\npub const MIGRATION_STAMP: u64 = {count};\n"),
|
||||
)
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user