fix: 三端联调测试 2 P0 + 6 P1 + 2 P2 修复
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
P0-1: SaaS relay 模型别名解析 — "glm-4-flash" → "glm-4-flash-250414" (resolve_model)
P0-2: config.rs interpolate_env_vars UTF-8 修复 (chars 迭代器替代 bytes as char)
+ DB 启动编码检查 + docker-compose UTF-8 编码参数
P1-3: UI 模型选择器覆盖 Agent 默认模型 (model_override 全链路: TS→Tauri→Rust kernel)
P1-6: 知识搜索管道修复 — seed_knowledge 创建 chunks + 默认分类 (seed/uploaded/distillation)
P1-7: 用量限额从当前 Plan 读取 (非 stale usage 表)
P1-8: relay 双维度配额检查 (relay_requests + input_tokens)
P2-9: SSE 路径 token 计数修复 — 流结束检测替代固定 500ms sleep + billing increment
This commit is contained in:
@@ -632,6 +632,8 @@ pub async fn unified_search(
|
||||
// === 种子知识冷启动 ===
|
||||
|
||||
/// 为指定行业插入种子知识(幂等)
|
||||
///
|
||||
/// P1-6 修复: 同时创建 knowledge_chunks 以支持搜索
|
||||
pub async fn seed_knowledge(
|
||||
pool: &PgPool,
|
||||
industry_id: &str,
|
||||
@@ -684,6 +686,24 @@ pub async fn seed_knowledge(
|
||||
.execute(pool)
|
||||
.await?;
|
||||
|
||||
// 创建 chunks 以支持搜索(与 distill_knowledge worker 一致)
|
||||
let chunks = chunk_content(content, 500, 50);
|
||||
for (chunk_idx, chunk_text) in chunks.iter().enumerate() {
|
||||
let chunk_id = uuid::Uuid::new_v4().to_string();
|
||||
sqlx::query(
|
||||
"INSERT INTO knowledge_chunks (id, item_id, content, keywords, chunk_index, created_at) \
|
||||
VALUES ($1, $2, $3, $4, $5, $6)"
|
||||
)
|
||||
.bind(&chunk_id)
|
||||
.bind(&id)
|
||||
.bind(chunk_text)
|
||||
.bind(&kw_json)
|
||||
.bind(chunk_idx as i32)
|
||||
.bind(&now)
|
||||
.execute(pool)
|
||||
.await?;
|
||||
}
|
||||
|
||||
created += 1;
|
||||
}
|
||||
Ok(created)
|
||||
|
||||
Reference in New Issue
Block a user