fix: Tauri commands camelCase + PeopleView perPage

This commit is contained in:
2026-06-14 19:02:15 +08:00
parent 2d7e65da6f
commit 620736a170
2 changed files with 19 additions and 19 deletions

View File

@@ -74,7 +74,7 @@ struct SearchIdentityResult {
const CORE_API: &str = "http://localhost:3002";
const API_KEY: &str = "muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69";
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn search_llm_smart(query: String, limit: usize) -> Result<Vec<SearchResult>, String> {
let client = reqwest::Client::new();
let url = format!("{}/api/v1/search/llm-smart?api_key={}", CORE_API, API_KEY);
@@ -116,7 +116,7 @@ struct GetFilesArgs {
page_size: usize,
}
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn get_files(args: GetFilesArgs) -> Result<Vec<FileInfo>, String> {
let page_size = args.page_size;
let client = reqwest::Client::new();
@@ -146,7 +146,7 @@ async fn get_files(args: GetFilesArgs) -> Result<Vec<FileInfo>, String> {
Ok(files)
}
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn get_people(page: usize, per_page: usize) -> Result<Vec<PersonInfo>, String> {
eprintln!("[get_people] page={} per_page={}", page, per_page);
let client = reqwest::Client::new();
@@ -174,7 +174,7 @@ async fn get_people(page: usize, per_page: usize) -> Result<Vec<PersonInfo>, Str
Ok(people)
}
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn get_faces(uuid: String, per_page: usize) -> Result<Vec<FaceInfo>, String> {
let client = reqwest::Client::new();
let url = format!("{}/api/v1/identity/{}/faces?api_key={}&page_size={}", CORE_API, uuid, API_KEY, per_page);
@@ -201,7 +201,7 @@ async fn get_faces(uuid: String, per_page: usize) -> Result<Vec<FaceInfo>, Strin
Ok(faces)
}
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn get_traces(uuid: String, per_page: usize) -> Result<Vec<TraceInfo>, String> {
let client = reqwest::Client::new();
let url = format!("{}/api/v1/identity/{}/traces?api_key={}&page_size={}", CORE_API, uuid, API_KEY, per_page);
@@ -228,7 +228,7 @@ async fn get_traces(uuid: String, per_page: usize) -> Result<Vec<TraceInfo>, Str
Ok(traces)
}
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn get_thumbnail(uuid: String, frame: u32) -> Result<String, String> {
let url = format!("{}/api/v1/file/{}/thumbnail?api_key={}&frame={}", CORE_API, uuid, API_KEY, frame);
let bytes = reqwest::get(&url).await
@@ -238,7 +238,7 @@ async fn get_thumbnail(uuid: String, frame: u32) -> Result<String, String> {
Ok(format!("data:image/jpeg;base64,{}", STANDARD.encode(&bytes)))
}
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn get_video_stream(uuid: String, start_time: f64, end_time: f64) -> Result<String, String> {
let url = format!("{}/api/v1/file/{}/video?api_key={}&start_time={}&end_time={}", CORE_API, uuid, API_KEY, start_time, end_time);
let bytes = reqwest::get(&url).await
@@ -259,7 +259,7 @@ const PROFILE_DIRS: &[&str] = &[
"/Users/accusys/momentry/output_dev/identities",
];
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn get_identity_profile(uuid: String) -> Result<String, String> {
let no_dash = uuid.replace('-', "");
for dir in PROFILE_DIRS {
@@ -277,7 +277,7 @@ async fn get_identity_profile(uuid: String) -> Result<String, String> {
Err("Profile image not found".to_string())
}
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn update_identity_name(uuid: String, name: String) -> Result<(), String> {
let client = reqwest::Client::new();
let url = format!("{}/api/v1/identity/{}?api_key={}", CORE_API, uuid, API_KEY);
@@ -291,7 +291,7 @@ async fn update_identity_name(uuid: String, name: String) -> Result<(), String>
Ok(())
}
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn delete_identity(uuid: String) -> Result<(), String> {
let client = reqwest::Client::new();
let url = format!("{}/api/v1/identity/{}?api_key={}", CORE_API, uuid, API_KEY);
@@ -304,7 +304,7 @@ async fn delete_identity(uuid: String) -> Result<(), String> {
Ok(())
}
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn search_identities(query: String, limit: usize) -> Result<Vec<SearchIdentityResult>, String> {
let client = reqwest::Client::new();
let url = format!("{}/api/v1/identities/search?api_key={}&q={}", CORE_API, API_KEY, query);
@@ -331,7 +331,7 @@ async fn search_identities(query: String, limit: usize) -> Result<Vec<SearchIden
Ok(results)
}
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn get_face_candidates(page: usize, per_page: usize) -> Result<Vec<FaceCandidate>, String> {
let client = reqwest::Client::new();
let url = format!("{}/api/v1/faces/candidates?api_key={}&page={}&page_size={}", CORE_API, API_KEY, page, per_page);
@@ -354,7 +354,7 @@ async fn get_face_candidates(page: usize, per_page: usize) -> Result<Vec<FaceCan
Ok(candidates)
}
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn merge_identities(uuid: String, into_uuid: String) -> Result<(), String> {
let client = reqwest::Client::new();
let url = format!("{}/api/v1/identity/{}/mergeinto?api_key={}", CORE_API, uuid, API_KEY);
@@ -368,7 +368,7 @@ async fn merge_identities(uuid: String, into_uuid: String) -> Result<(), String>
Ok(())
}
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn bind_face(uuid: String, face_id: String, file_uuid: String) -> Result<(), String> {
let client = reqwest::Client::new();
let url = format!("{}/api/v1/identity/{}/bind?api_key={}", CORE_API, uuid, API_KEY);
@@ -382,7 +382,7 @@ async fn bind_face(uuid: String, face_id: String, file_uuid: String) -> Result<(
Ok(())
}
#[tauri::command]
#[tauri::command(rename_all = "camelCase")]
async fn unbind_face(uuid: String, face_id: String, file_uuid: String) -> Result<(), String> {
let client = reqwest::Client::new();
let url = format!("{}/api/v1/identity/{}/unbind?api_key={}", CORE_API, uuid, API_KEY);

View File

@@ -146,7 +146,7 @@ const filteredPeople = computed(() => {
onMounted(async () => {
debugMsg.value = 'PeopleView mounted! Loading...'
try {
const result: any = await invoke('get_people', { page: 1, per_page: 1000 })
const result: any = await invoke('get_people', { page: 1, perPage: 1000 })
debugMsg.value = `get_people: ${Array.isArray(result)} length=${result?.length ?? 'N/A'}`
people.value = Array.isArray(result) ? result : []
} catch (e: any) {
@@ -185,8 +185,8 @@ async function selectPerson(p: any) {
selectedProfile.value = profiles.value[p.identity_uuid] || ''
activeTab.value = 'faces'
try {
const fResult: any = await invoke('get_faces', { uuid: p.identity_uuid, per_page: 100 })
const tResult: any = await invoke('get_traces', { uuid: p.identity_uuid, per_page: 100 })
const fResult: any = await invoke('get_faces', { uuid: p.identity_uuid, perPage: 100 })
const tResult: any = await invoke('get_traces', { uuid: p.identity_uuid, perPage: 100 })
faces.value = Array.isArray(fResult) ? fResult : []
traces.value = Array.isArray(tResult) ? tResult : []
} catch (e) { console.error('Failed to load details:', e) }
@@ -215,7 +215,7 @@ async function confirmDelete() {
async function loadCandidates() {
try {
const result: any = await invoke('get_face_candidates', { page: 1, per_page: 50 })
const result: any = await invoke('get_face_candidates', { page: 1, perPage: 50 })
candidates.value = Array.isArray(result) ? result : []
} catch (e) { console.error('Failed to load candidates:', e) }
}