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:
@@ -170,8 +170,43 @@ struct ASRXSwift: ParsableCommand {
|
||||
}
|
||||
|
||||
func resolveLanguage() -> String {
|
||||
if !language.isEmpty { return language }
|
||||
let candidates = ["zh-TW", "zh-Hans", "en-US", "ja-JP", "ko-KR"]
|
||||
// 1. If --language is specified, use it
|
||||
if !language.isEmpty {
|
||||
print("[ASRX_Swift] Using specified language: \(language)")
|
||||
return language
|
||||
}
|
||||
|
||||
// 2. Try to read language from ASR JSON
|
||||
let outputDir = URL(fileURLWithPath: outputPath).deletingLastPathComponent()
|
||||
let fileUUID = URL(fileURLWithPath: outputPath).deletingPathExtension().lastPathComponent
|
||||
let asrJsonPath = outputDir.appendingPathComponent("\(fileUUID).asr.json").path
|
||||
|
||||
if FileManager.default.fileExists(atPath: asrJsonPath) {
|
||||
do {
|
||||
let asrData = try Data(contentsOf: URL(fileURLWithPath: asrJsonPath))
|
||||
if let asrJson = try JSONSerialization.jsonObject(with: asrData) as? [String: Any],
|
||||
let asrLang = asrJson["language"] as? String {
|
||||
// Map ASR language codes to Apple locale identifiers
|
||||
let langMap: [String: String] = [
|
||||
"en": "en-US",
|
||||
"zh": "zh-TW",
|
||||
"ja": "ja-JP",
|
||||
"ko": "ko-KR",
|
||||
"es": "es-ES",
|
||||
"fr": "fr-FR",
|
||||
"de": "de-DE",
|
||||
]
|
||||
let appleLang = langMap[asrLang] ?? asrLang
|
||||
print("[ASRX_Swift] Using language from ASR JSON: \(asrLang) -> \(appleLang)")
|
||||
return appleLang
|
||||
}
|
||||
} catch {
|
||||
print("[ASRX_Swift] Warning: Failed to read ASR JSON: \(error)")
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Fallback to auto-detection (prioritize en-US)
|
||||
let candidates = ["en-US", "zh-TW", "zh-Hans", "ja-JP", "ko-KR"]
|
||||
for localeId in candidates {
|
||||
if let reco = SFSpeechRecognizer(locale: Locale(identifier: localeId)), reco.isAvailable {
|
||||
print("[ASRX_Swift] Auto-detected language: \(localeId)")
|
||||
|
||||
@@ -66,8 +66,8 @@ struct FaceNetEmbedding: ParsableCommand {
|
||||
for j in 0..<faces.count {
|
||||
var face = faces[j]
|
||||
|
||||
// Skip if already has embedding
|
||||
if face["embedding"] != nil {
|
||||
// Skip if already has valid embedding (not null and not empty)
|
||||
if let existingEmbedding = face["embedding"] as? [Float], !existingEmbedding.isEmpty {
|
||||
embeddingCount += 1
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -177,51 +177,13 @@ struct SwiftFace: ParsableCommand {
|
||||
}
|
||||
}
|
||||
|
||||
// Match face observation by bbox to extract faceprint (embedding)
|
||||
var embedding: [Float]? = nil
|
||||
if #available(macOS 14, *) {
|
||||
var matchCount = 0
|
||||
for faceObs in faceObservations {
|
||||
let fBB = faceObs.boundingBox
|
||||
let ix = max(bb.minX, fBB.origin.x)
|
||||
let iy = max(bb.minY, fBB.origin.y)
|
||||
let iw = min(bb.maxX, fBB.origin.x + fBB.width) - ix
|
||||
let ih = min(bb.maxY, fBB.origin.y + fBB.height) - iy
|
||||
if iw <= 0 || ih <= 0 { continue }
|
||||
let intersection = iw * ih
|
||||
let union = bb.width * bb.height + fBB.width * fBB.height - intersection
|
||||
if intersection / union > 0.5 {
|
||||
matchCount += 1
|
||||
// Try to extract faceprint
|
||||
if let fp = faceObs.value(forKey: "faceprint") as? NSObject {
|
||||
if let desc = fp.value(forKey: "descriptor") as? NSObject {
|
||||
if let elems = desc.value(forKey: "elements") as? [NSNumber] {
|
||||
embedding = elems.map { Float($0.doubleValue) }
|
||||
} else {
|
||||
print("[DEBUG] No elements in descriptor")
|
||||
}
|
||||
} else {
|
||||
print("[DEBUG] No descriptor in faceprint")
|
||||
}
|
||||
} else {
|
||||
print("[DEBUG] No faceprint in faceObs (frame \(frameNumber), match \(matchCount))")
|
||||
}
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var faceData: [String: Any] = [
|
||||
"bbox": ["x": max(0, faceX), "y": max(0, faceY),
|
||||
"width": faceW, "height": faceH],
|
||||
"confidence": Double(lmObs.confidence),
|
||||
"captureQuality": captureQ,
|
||||
]
|
||||
|
||||
// Add embedding if available
|
||||
if let emb = embedding {
|
||||
faceData["embedding"] = emb
|
||||
}
|
||||
// NOTE: embedding is NOT stored in JSON, only in Qdrant via Rust worker
|
||||
|
||||
// Pose from landmark observation
|
||||
if let yaw = lmObs.yaw?.doubleValue,
|
||||
|
||||
Reference in New Issue
Block a user