feat: Face JSON v2 schema - add schema_version, bbox x2/y2/center, keep embeddings, update clustering
This commit is contained in:
+120
-74
@@ -4,14 +4,16 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Momentry API Docs</title>
|
||||
<script src="https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.min.js"></script>
|
||||
<script>mermaid.initialize({startOnLoad:false,theme:'base',themeVariables:{primaryColor:'#e8f4fd',primaryBorderColor:'#4a90d9',primaryTextColor:'#333',lineColor:'#4a90d9',secondaryColor:'#fef3e2',secondaryBorderColor:'#d9a84a',tertiaryColor:'#e8f8e8'}});</script>
|
||||
<meta name="version" content="2026-10-25-v2">
|
||||
<meta name="cache-bust" content="<?= time() ?>">
|
||||
<script>console.log('=== HEAD: Script tag in head loaded ===');</script>
|
||||
|
||||
<style>
|
||||
* { margin: 0; padding: 0; box-sizing: border-box; }
|
||||
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; background: #f5f5f5; color: #333; }
|
||||
#app { display: flex; min-height: 100vh; }
|
||||
html, body { height: 100%; }
|
||||
.sidebar { width: 260px; height: 100vh; position: sticky; top: 0; overflow-y: auto; background: #fff; border-right: 1px solid #ddd; padding: 20px; display: flex; flex-direction: column; }
|
||||
.sidebar { width: 280px; min-width: 280px; height: 100vh; position: sticky; top: 0; overflow-y: auto; background: #fff; border-right: 1px solid #ddd; padding: 20px; display: flex; flex-direction: column; }
|
||||
.sidebar h1 { font-size: 18px; margin-bottom: 16px; }
|
||||
.sidebar a { display: block; padding: 6px 0; color: #0066cc; text-decoration: none; font-size: 14px; cursor: pointer; }
|
||||
.sidebar a:hover { color: #003d80; }
|
||||
@@ -53,32 +55,59 @@ html, body { height: 100%; }
|
||||
</div>
|
||||
<script>
|
||||
const MODULES = [
|
||||
["01_auth","安全認證","Authentication"],
|
||||
["02_health","健康檢查","Health"],
|
||||
["03_register","檔案註冊","File Registration"],
|
||||
["04_lookup","檔案屬性查詢","File Lookup"],
|
||||
["05_process","處理流程","Processing"],
|
||||
["06_search","搜尋功能","Search"],
|
||||
["07_identity","身份識別","Identity"],
|
||||
["08_identity_agent","智能身份綁定","Smart Identity Binding"],
|
||||
["08_media","串流與截圖","Streaming & Thumbnails"],
|
||||
["09_tmdb","TMDb 整合","TMDb Integration"],
|
||||
["10_pipeline","生產線","Pipeline"],
|
||||
["12_agent","智慧代理","AI Agents"],
|
||||
["13_config","系統設定","System Config"],
|
||||
["14_identity_history","操作歷史","Operation History (Undo/Redo)"],
|
||||
["15_tkg","時序知識圖譜","Temporal Knowledge Graph"],
|
||||
["16_workspace","工作區管理","Workspace Checkin/Checkout"],
|
||||
["99_incomplete","未完成項目","Incomplete / Undocumented APIs"],
|
||||
["000_Welcome", "Welcome - 歡迎頁面", "Welcome - API & CLI Index"],
|
||||
["000_PeopleAPI_v1.0.0", "people api API", "people api API"],
|
||||
["001_Auth_v1.3.5", "Auth API", "Auth API"],
|
||||
["002_Health_v1.3.5", "health API", "health API"],
|
||||
["011_Register_v1.3.5", "register API", "register API"],
|
||||
["012_Lookup_v1.3.5", "lookup API", "lookup API"],
|
||||
["021_Process_v1.3.5", "process API", "process API"],
|
||||
["022_Pipeline_v1.3.5", "pipeline API", "pipeline API"],
|
||||
["023_Progress_v1.3.5", "progress API", "progress API"],
|
||||
["024_JobManagement_v1.3.5", "Job Management API", "Job Management API"],
|
||||
["025_Checkin_v1.3.5", "Checkin API", "Checkin API"],
|
||||
["031_Search_v1.3.5", "search API", "search API"],
|
||||
["032_VLMSearch_v1.3.5", "VLM Search API", "VLM Search API"],
|
||||
["033_SceneVLMStats_v1.3.5", "Scene VLM Stats API", "Scene VLM Stats API"],
|
||||
["041_Identity_v1.3.5", "identity API", "identity API"],
|
||||
["042_IdentityAgent_v1.3.5", "identity agent API", "identity agent API"],
|
||||
["043_IdentityHistory_v1.3.5", "identity history API", "identity history API"],
|
||||
["044_FaceFilter_v1.3.5", "Face Filter API", "Face Filter API"],
|
||||
["051_Media_v1.3.5", "Media API", "Media API"],
|
||||
["052_Profile_v1.3.5", "profile API", "profile API"],
|
||||
["053_PoseAppearance_v1.3.5", "Pose & Appearance API", "Pose & Appearance API"],
|
||||
["054_TraceThumbnail_v1.3.5", "Trace Thumbnail API", "Trace Thumbnail API"],
|
||||
["061_TMDB_v1.3.5", "tmdb API", "tmdb API"],
|
||||
["062_Agent_v1.3.5", "agent API", "agent API"],
|
||||
["063_TKG_v1.3.5", "tkg API", "tkg API"],
|
||||
["064_TraceAgent_v1.3.5", "Trace Agent API", "Trace Agent API"],
|
||||
["065_ClusterAgent_v1.3.5", "Cluster Agent API", "Cluster Agent API"],
|
||||
["071_ErrorCodes_v1.3.5", "error codes API", "error codes API"],
|
||||
["072_Config_v1.3.5", "config API", "config API"],
|
||||
["073_Workspace_v1.3.5", "workspace API", "workspace API"],
|
||||
["074_ServiceManagement_v1.3.5", "Service Management API", "Service Management API"],
|
||||
["075_Monitor_v1.3.5", "Monitor API", "Monitor API"],
|
||||
["076_AdminConfig_v1.3.5", "Admin Config API", "Admin Config API"],
|
||||
["077_Docs_v1.3.5", "Docs API", "Docs API"],
|
||||
["078_MarkbaseCompat_v1.3.5", "Markbase Compat API", "Markbase Compat API"],
|
||||
["081_CLIP_v1.3.5", "CLIP API", "CLIP API"],
|
||||
["082_Billing_v1.3.5", "Billing API", "Billing API"],
|
||||
["101_CLI_Register_v1.3.5", "CLI Register", "CLI Register"],
|
||||
["102_CLI_Process_v1.3.5", "CLI Process", "CLI Process"],
|
||||
["201_StudioTeamGuide_v1.3.5", "Studio Team Guide", "Studio Team Guide"],
|
||||
["202_StudioPipelineChanges_v1.3.5", "Studio Pipeline Changes", "Studio Pipeline Changes"],
|
||||
["203_StudioFaceGroupFix_v1.3.5", "Studio Face Group Fix", "Studio Face Group Fix"],
|
||||
["204_StudioTraceProfileBug_v1.3.5", "Studio Trace Profile Bug", "Studio Trace Profile Bug"],
|
||||
["990_Incomplete_v1.3.5", "Incomplete", "Incomplete"]
|
||||
];
|
||||
|
||||
const el = document.getElementById('content');
|
||||
// Initialize el after DOM is ready
|
||||
let el = null;
|
||||
let wasm_render = null;
|
||||
|
||||
let wasm_exports = null;
|
||||
|
||||
async function initWasm() {
|
||||
const resp = await fetch('/doc-wasm/pkg/md_wasm_bg.wasm');
|
||||
const resp = await fetch('/pkg/md_wasm_bg.wasm');
|
||||
if (!resp.ok) throw new Error('WASM fetch failed: ' + resp.status);
|
||||
const bytes = await resp.arrayBuffer();
|
||||
|
||||
@@ -135,11 +164,11 @@ function md2html(md) {
|
||||
async function loadDoc(name, highlightQ) {
|
||||
el.innerHTML = '<p>Loading...</p>';
|
||||
try {
|
||||
const resp = await fetch('/doc-wasm/modules/' + name + '.md');
|
||||
if (!resp.ok) throw new Error('HTTP ' + resp.status + ' fetching /doc-wasm/modules/' + name + '.md');
|
||||
const resp = await fetch('/modules/' + name + '.md');
|
||||
if (!resp.ok) throw new Error('HTTP ' + resp.status + ' fetching /modules/' + name + '.md');
|
||||
const md = await resp.text();
|
||||
if (!wasm_exports) throw new Error('WASM not loaded');
|
||||
var dlHtml = '<div style="float:right;margin-bottom:8px"><a href="/doc-wasm/modules/' + name + '.md" download="' + name + '.md" style="text-decoration:none;font-size:13px;color:#0066cc;border:1px solid #0066cc;border-radius:4px;padding:4px 10px">↓ Download .md</a></div>';
|
||||
var dlHtml = '<div style="float:right;margin-bottom:8px"><a href="/modules/' + name + '.md" download="' + name + '.md" style="text-decoration:none;font-size:13px;color:#0066cc;border:1px solid #0066cc;border-radius:4px;padding:4px 10px">↓ Download .md</a></div>';
|
||||
el.innerHTML = dlHtml + md2html(md);
|
||||
if (typeof mermaid !== 'undefined') mermaid.run({nodes:[el.querySelector('.mermaid')].filter(Boolean)});
|
||||
document.querySelectorAll('.sidebar a.module-link').forEach(function(a) { a.classList.remove('active'); });
|
||||
@@ -195,7 +224,7 @@ async function fulltextSearch(q) {
|
||||
for (var i = 0; i < MODULES.length; i++) {
|
||||
var m = MODULES[i];
|
||||
try {
|
||||
var resp = await fetch('/doc-wasm/modules/' + m[0] + '.md');
|
||||
var resp = await fetch('/modules/' + m[0] + '.md');
|
||||
if (!resp.ok) continue;
|
||||
var md = await resp.text();
|
||||
var lines = md.split('\n');
|
||||
@@ -241,41 +270,26 @@ function clearSearch() {
|
||||
el.dispatchEvent(evt);
|
||||
}
|
||||
|
||||
async function loginUser(user, pass) {
|
||||
var resp = await fetch('/api/v1/auth/login', {
|
||||
method:'POST', headers:{'Content-Type':'application/json'},
|
||||
body: JSON.stringify({username:user, password:pass})
|
||||
});
|
||||
return resp.ok;
|
||||
}
|
||||
|
||||
function showLoginForm() {
|
||||
el.innerHTML = '<div style="max-width:360px;margin:80px auto;background:#fff;border-radius:12px;box-shadow:0 2px 12px rgba(0,0,0,0.08);padding:40px;text-align:center">' +
|
||||
'<h1 style="font-size:24px;margin-bottom:24px">Momentry Docs</h1>' +
|
||||
'<form onsubmit="doLogin();return false">' +
|
||||
'<input type="text" id="login-user" placeholder="Username" value="demo" style="width:100%;padding:10px;margin-bottom:12px;border:1px solid #ddd;border-radius:6px;font-size:14px">' +
|
||||
'<input type="password" id="login-pass" placeholder="Password" value="" style="width:100%;padding:10px;margin-bottom:12px;border:1px solid #ddd;border-radius:6px;font-size:14px">' +
|
||||
'<div id="login-err" style="color:#cc0000;font-size:13px;margin-bottom:12px;display:none">Invalid credentials</div>' +
|
||||
'<button type="submit" style="width:100%;padding:10px;background:#0066cc;color:#fff;border:none;border-radius:6px;font-size:16px;cursor:pointer">Login</button>' +
|
||||
'</form>' +
|
||||
'</div>';
|
||||
}
|
||||
window.doLogin = async function() {
|
||||
var u = document.getElementById('login-user').value;
|
||||
var p = document.getElementById('login-pass').value;
|
||||
if (await loginUser(u, p)) {
|
||||
document.getElementById('sidebar').style.display = 'flex';
|
||||
await initApp();
|
||||
} else {
|
||||
document.getElementById('login-err').style.display = 'block';
|
||||
}
|
||||
};
|
||||
|
||||
async function initApp() {
|
||||
console.log('=== initApp started ===');
|
||||
|
||||
// Initialize el after DOM is ready
|
||||
el = document.getElementById('content');
|
||||
if (!el) {
|
||||
console.error('content element not found!');
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
console.log('Setting innerHTML to Loading WASM...');
|
||||
el.innerHTML = '<p>Loading WASM...</p>';
|
||||
console.log('Calling initWasm...');
|
||||
await initWasm();
|
||||
console.log('initWasm completed');
|
||||
el.innerHTML = '<p>Building modules...</p>';
|
||||
console.log('Building module list...');
|
||||
var listEl = document.getElementById('module-list');
|
||||
listEl.innerHTML = '';
|
||||
MODULES.forEach(function(m) {
|
||||
@@ -305,7 +319,7 @@ async function initApp() {
|
||||
a.style.display = a.textContent.toLowerCase().indexOf(q) >= 0 ? '' : 'none';
|
||||
});
|
||||
if (searchTimer) clearTimeout(searchTimer);
|
||||
if (!q) loadDoc(location.hash.slice(1) || '01_auth');
|
||||
if (!q) loadDoc(location.hash.slice(1) || '000_Welcome');
|
||||
return;
|
||||
}
|
||||
moduleListEl.style.display = 'none';
|
||||
@@ -328,20 +342,43 @@ async function initApp() {
|
||||
|
||||
document.getElementById('sidebar').style.display = 'flex';
|
||||
|
||||
document.getElementById('logout-btn').onclick = async function(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
try {
|
||||
await fetch('/api/v1/auth/logout', {method:'POST', credentials:'include'});
|
||||
} catch(_) {}
|
||||
sessionStorage.removeItem('doc_search_q');
|
||||
// Clear client-side cookies
|
||||
document.cookie.split(';').forEach(function(c) {
|
||||
document.cookie = c.trim().split('=')[0] + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/';
|
||||
});
|
||||
document.getElementById('sidebar').style.display = 'none';
|
||||
showLoginForm();
|
||||
};
|
||||
// Logout button - clear session and force re-auth
|
||||
var logoutBtn = document.getElementById('logout-btn');
|
||||
console.log('Logout button element:', logoutBtn);
|
||||
|
||||
if (logoutBtn) {
|
||||
logoutBtn.onclick = function(e) {
|
||||
console.log('Logout button clicked!');
|
||||
e.preventDefault();
|
||||
|
||||
var confirmed = confirm(
|
||||
'⚠️ Logout Confirmation / 登出确认\n\n' +
|
||||
'You will be logged out and cannot login directly.\n' +
|
||||
'登出后无法直接重新登录。\n\n' +
|
||||
'To login again:\n' +
|
||||
'重新登录步骤:\n' +
|
||||
'1. Close this tab / 关闭此标签页\n' +
|
||||
'2. Open new tab / 打开新标签页\n' +
|
||||
'3. Visit website and login / 访问网站并登录\n\n' +
|
||||
'Continue logout? / 确定登出吗?'
|
||||
);
|
||||
|
||||
if (!confirmed) {
|
||||
console.log('Logout cancelled by user');
|
||||
return;
|
||||
}
|
||||
|
||||
sessionStorage.clear();
|
||||
localStorage.clear();
|
||||
|
||||
console.log('Navigating to logout page');
|
||||
|
||||
window.location.href = '/logout.html';
|
||||
};
|
||||
console.log('Logout button event bound successfully');
|
||||
} else {
|
||||
console.error('Logout button not found!');
|
||||
}
|
||||
|
||||
// Restore search query across page refresh
|
||||
var savedQ = sessionStorage.getItem('doc_search_q');
|
||||
@@ -355,20 +392,29 @@ async function initApp() {
|
||||
} else {
|
||||
// Load initial module from hash or default
|
||||
var hash = location.hash.slice(1);
|
||||
await loadDoc(hash || '01_auth');
|
||||
await loadDoc(hash || '000_Welcome');
|
||||
}
|
||||
} catch(e) {
|
||||
console.error('=== initApp ERROR ===', e);
|
||||
el.innerHTML = '<p style="color:red">Init error: ' + e.message + '</p><pre>'+e.stack+'</pre>';
|
||||
}
|
||||
console.log('=== initApp completed ===');
|
||||
}
|
||||
|
||||
async function init() {
|
||||
// Hide sidebar until authenticated
|
||||
document.getElementById('sidebar').style.display = 'none';
|
||||
showLoginForm();
|
||||
console.log('=== init started ===');
|
||||
// HTTP Basic Auth handled by docserver middleware
|
||||
// Directly initialize the app
|
||||
try {
|
||||
await initApp();
|
||||
} catch(e) {
|
||||
console.error('=== init ERROR ===', e);
|
||||
}
|
||||
}
|
||||
|
||||
console.log('=== BEFORE init() call ===');
|
||||
init();
|
||||
console.log('=== AFTER init() call ===');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user