remove: Portal project (Core Team 不再維護前端)

- 移除 portal/ 目錄 (Vue 3 + Tauri 前端)
- 更新 AGENTS.md 移除 Portal 相關說明
- 更新代碼註釋移除 Portal 引用
- 前端開發統一由 Studio Team 負責

參考: docs_v1.0/OPERATIONS/GUI_ARCHITECTURE_REVIEW.md
This commit is contained in:
Accusys
2026-09-30 18:59:40 +08:00
parent 144ec0768a
commit 4b694a1c2d
198 changed files with 3675 additions and 29374 deletions
+4 -4
View File
@@ -355,10 +355,10 @@ async fn list_face_candidates(
let offset = (page - 1) * page_size;
let min_confidence = query.min_confidence.unwrap_or(0.5);
// Query Qdrant _faces for unbound faces (identity_id IS NULL)
// Query Qdrant _faces for unbound faces (identity_id = 0 means unbound)
let qdrant = crate::core::db::qdrant_db::QdrantDb::new();
let mut filter_must = vec![
serde_json::json!({"is_null": {"key": "identity_id"}}),
serde_json::json!({"key": "identity_id", "match": {"value": 0}}),
serde_json::json!({"key": "confidence", "range": {"gte": min_confidence}}),
];
if let Some(ref file_uuid) = query.file_uuid {
@@ -469,10 +469,10 @@ async fn list_unassigned_traces(
None
};
// Query Qdrant _faces for unbound traces (identity_id IS NULL, trace_id >= 0)
// Query Qdrant _faces for unbound traces (identity_id = 0 means unbound, trace_id >= 0)
let qdrant = crate::core::db::qdrant_db::QdrantDb::new();
let mut filter_must: Vec<serde_json::Value> = vec![
serde_json::json!({"is_null": {"key": "identity_id"}}),
serde_json::json!({"key": "identity_id", "match": {"value": 0}}),
serde_json::json!({"key": "trace_id", "range": {"gte": 0}}),
];
if let Some(ref file_uuid) = query.file_uuid {
+1 -1
View File
@@ -122,7 +122,7 @@ pub async fn unified_auth(
let headers = request.headers();
let uri = request.uri().clone();
// Priority 1: Cookie session (Portal)
// Priority 1: Cookie session
let cookies = extract_cookies(headers);
if let Some(sid) = cookies
.iter()
+16
View File
@@ -881,6 +881,22 @@ async fn get_processor_counts(
}
}
}
// Special handling for face_cluster: query trace_profiles if frame_count is None
if proc_name == "face_cluster" && frame_count.is_none() {
let tp_table = crate::core::db::schema::table_name("trace_profiles");
let trace_count: i64 = sqlx::query_scalar(&format!(
"SELECT COUNT(DISTINCT trace_id) FROM {} WHERE file_uuid = $1 AND frame_count > 0",
tp_table
))
.bind(&file_uuid)
.fetch_one(state.db.pool())
.await
.unwrap_or(0);
if trace_count > 0 {
frame_count = Some(trace_count as u32);
}
}
results.push(ProcessorCountInfo {
processor: proc_name.to_string(),
+1 -1
View File
@@ -11,7 +11,7 @@ fn get_timestamp() -> String {
#[derive(Parser)]
#[command(name = "momentry-cli")]
#[command(about = "CLI Agent Interface for Momentry Portal")]
#[command(about = "CLI Agent Interface for Momentry")]
struct Cli {
#[command(subcommand)]
command: Commands,
+105 -27
View File
@@ -226,41 +226,26 @@ let swift_face_path = std::path::Path::new("/Users/accusys/momentry_core/scripts
}
}
// Store embeddings to Qdrant after FaceNet completes
// Read the JSON (with embeddings from FaceNet)
let json_str = std::fs::read_to_string(output_path).context("Failed to read FACE output")?;
let mut result: FaceResult = serde_json::from_str(&json_str).context("Failed to parse FACE output")?;
result.compute_status();
// Store embeddings to Qdrant and remove from JSON
if let Some(file_uuid) = uuid {
tracing::info!("[FACE] Storing embeddings to Qdrant for {}", file_uuid);
let store_script = std::path::Path::new("/Users/accusys/momentry_core/scripts/store_face_embeddings_to_qdrant.py");
if store_script.exists() {
let store_output = tokio::process::Command::new("python3")
.arg(store_script)
.arg("--file-uuid")
.arg(file_uuid)
.output()
.await;
match store_output {
Ok(output) if output.status.success() => {
tracing::info!("[FACE] Embeddings stored to Qdrant successfully");
}
Ok(output) => {
let stderr = String::from_utf8_lossy(&output.stderr);
tracing::warn!("[FACE] Embedding storage failed: {}", stderr);
}
Err(e) => {
tracing::warn!("[FACE] Embedding storage error: {}", e);
}
match store_face_embeddings_to_qdrant(file_uuid, &mut result, output_path).await {
Ok(count) => {
tracing::info!("[FACE] Stored {} embeddings to Qdrant", count);
}
Err(e) => {
tracing::warn!("[FACE] Failed to store embeddings to Qdrant: {}", e);
}
} else {
tracing::warn!("[FACE] store_face_embeddings_to_qdrant.py not found");
}
} else {
tracing::warn!("[FACE] No UUID provided, skipping Qdrant storage");
}
let json_str = std::fs::read_to_string(output_path).context("Failed to read FACE output")?;
let mut result: FaceResult = serde_json::from_str(&json_str).context("Failed to parse FACE output")?;
result.compute_status();
// Execute face tracking
tracing::info!("[FACE] Starting face tracking");
use crate::core::processor::face_tracker::track_faces;
@@ -595,3 +580,96 @@ mod tests {
assert_eq!(embedding[0], 0.1);
}
}
/// Store face embeddings to Qdrant and remove them from JSON
pub async fn store_face_embeddings_to_qdrant(
file_uuid: &str,
face_result: &mut FaceResult,
output_path: &str,
) -> Result<usize> {
use crate::core::db::qdrant_db::QdrantDb;
use uuid::Uuid;
let qdrant = QdrantDb::new();
let mut points: Vec<(u64, Vec<f32>, serde_json::Value)> = Vec::new();
let fps = face_result.fps;
// Prepare points with embeddings
for frame in &face_result.frames {
let frame_num = frame.frame;
let timestamp_secs = frame_num as f64 / fps;
for face in &frame.faces {
if let Some(embedding) = &face.embedding {
let point_id = Uuid::new_v4().as_u128() as u64;
let payload = serde_json::json!({
"file_uuid": file_uuid,
"frame": frame_num,
"timestamp_secs": timestamp_secs,
"face_id": face.face_id.as_deref().unwrap_or(""),
"confidence": face.confidence,
"x": face.x,
"y": face.y,
"width": face.width,
"height": face.height,
"trace_id": -1i32, // Will be updated by face tracing
});
points.push((point_id, embedding.clone(), payload));
}
}
}
let total_points = points.len();
if total_points == 0 {
tracing::info!("[FACE] No embeddings to store for {}", file_uuid);
return Ok(0);
}
// Delete old points for this file
let filter = serde_json::json!({
"must": [{
"key": "file_uuid",
"match": {"value": file_uuid}
}]
});
if let Err(e) = qdrant.delete_points_by_filter("_faces", filter).await {
tracing::warn!("[FACE] Failed to delete old points: {}", e);
} else {
tracing::info!("[FACE] Deleted old points for {}", file_uuid);
}
// Upsert new points in batches
let batch_size = 100;
for (i, chunk) in points.chunks(batch_size).enumerate() {
let batch_points: Vec<(u64, &[f32], Option<serde_json::Value>)> = chunk
.iter()
.map(|(id, vec, payload)| (*id, vec.as_slice(), Some(payload.clone())))
.collect();
qdrant.upsert_vectors_batch("_faces", &batch_points).await
.with_context(|| format!("Failed to upsert batch {}", i + 1))?;
}
tracing::info!("[FACE] Stored {} embeddings to Qdrant", total_points);
// Remove embeddings from in-memory result
for frame in &mut face_result.frames {
for face in &mut frame.faces {
face.embedding = None;
}
}
// Save cleaned JSON back
let json_str = serde_json::to_string_pretty(&face_result)
.context("Failed to serialize cleaned face result")?;
std::fs::write(output_path, &json_str)
.context("Failed to write cleaned face.json")?;
tracing::info!("[FACE] Removed embeddings from JSON, saved to {}", output_path);
Ok(total_points)
}