Fixing
This commit is contained in:
parent
44b6faaeb9
commit
95ce7b343c
4 changed files with 20 additions and 4 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
# .github/workflows/build-and-deploy.yml
|
# .github/workflows/build-and-deploy.yml
|
||||||
|
|
||||||
name: Build and Deploy
|
name: Build and Deploy Fallback
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
|
|
||||||
|
|
@ -32,3 +32,7 @@ pub fn delete_file(path: &Path) -> Result<()> {
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn public_url_for(filename: &str) -> String {
|
||||||
|
format!("/storage/{}", filename)
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
use crate::gemini_client::{demo_text_embedding, generate_text_with_model, DEMO_EMBED_DIM};
|
use crate::gemini_client::{demo_text_embedding, generate_text_with_model, DEMO_EMBED_DIM};
|
||||||
use crate::models::{QueryRecord, QueryStatus};
|
use crate::models::{QueryRecord, QueryStatus};
|
||||||
|
use crate::storage;
|
||||||
use crate::vector;
|
use crate::vector;
|
||||||
use crate::vector_db::QdrantClient;
|
use crate::vector_db::QdrantClient;
|
||||||
use anyhow::Result;
|
use anyhow::Result;
|
||||||
|
|
@ -129,7 +130,7 @@ impl Worker {
|
||||||
// Stage 4: fetch file metadata for IDs
|
// Stage 4: fetch file metadata for IDs
|
||||||
let mut files_json = Vec::new();
|
let mut files_json = Vec::new();
|
||||||
for (fid, score) in hits {
|
for (fid, score) in hits {
|
||||||
if let Some(row) = sqlx::query("SELECT id, filename, path, description FROM files WHERE id = ? AND pending_analysis = FALSE")
|
if let Some(row) = sqlx::query("SELECT id, filename, path, description, analysis_status FROM files WHERE id = ? AND pending_analysis = FALSE")
|
||||||
.bind(&fid)
|
.bind(&fid)
|
||||||
.fetch_optional(&self.pool)
|
.fetch_optional(&self.pool)
|
||||||
.await? {
|
.await? {
|
||||||
|
|
@ -138,8 +139,16 @@ impl Worker {
|
||||||
let filename: String = row.get("filename");
|
let filename: String = row.get("filename");
|
||||||
let path: String = row.get("path");
|
let path: String = row.get("path");
|
||||||
let description: Option<String> = row.get("description");
|
let description: Option<String> = row.get("description");
|
||||||
|
let status: Option<String> = row.try_get("analysis_status").ok();
|
||||||
|
let storage_url = storage::public_url_for(&filename);
|
||||||
files_json.push(serde_json::json!({
|
files_json.push(serde_json::json!({
|
||||||
"id": id, "filename": filename, "path": path, "description": description, "score": score
|
"id": id,
|
||||||
|
"filename": filename,
|
||||||
|
"path": path,
|
||||||
|
"storage_url": storage_url,
|
||||||
|
"description": description,
|
||||||
|
"analysis_status": status,
|
||||||
|
"score": score
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,10 @@ export default function ChatLayout() {
|
||||||
.filter((f) => f && typeof f === "object")
|
.filter((f) => f && typeof f === "object")
|
||||||
.map((file) => {
|
.map((file) => {
|
||||||
const filename = file.filename || file.id || "download";
|
const filename = file.filename || file.id || "download";
|
||||||
const linkTarget = `/storage/${encodeURIComponent(filename)}`;
|
const storageUrl = file.storage_url || `/storage/${filename}`;
|
||||||
|
const linkTarget = storageUrl.startsWith("/storage/")
|
||||||
|
? `/storage/${encodeURIComponent(storageUrl.replace("/storage/", ""))}`
|
||||||
|
: storageUrl;
|
||||||
const description = file.description?.trim();
|
const description = file.description?.trim();
|
||||||
const score =
|
const score =
|
||||||
typeof file.score === "number"
|
typeof file.score === "number"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue