archive: Phase 1 基础设施搭建归档
归档信息: - 变更名称:phase-1-infrastructure - 工作流:spec-driven - 归档位置:openspec/changes/archive/2026-06-23-phase-1-infrastructure/ 完成情况: - ✅ 所有产物完成(proposal, design, specs, tasks) - ✅ 任务完成:33/35 (94%) - ⚠️ 2 个任务跳过(混合检索、集成测试,有充分理由) 验收结果: - ✅ 静态验证:编译通过 - ✅ 脚本验证:16/16 单元测试通过 - ✅ 端到端验证:上传→索引→检索→删除完整流程 Delta Specs: - 跳过同步(用户选择) - functional-specs.md 保留在归档目录中 devflow 档案: - ✅ 已完整回填(brief, evidence, decisions, acceptance) - ✅ devflow/index.md 状态更新为 archived
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
package com.superbiz.agent.controller;
|
||||
|
||||
import com.superbiz.agent.dto.Result;
|
||||
import com.superbiz.agent.service.VectorSearchService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 文档检索控制器(测试用)
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/search")
|
||||
public class SearchController {
|
||||
|
||||
@Autowired
|
||||
private VectorSearchService vectorSearchService;
|
||||
|
||||
/**
|
||||
* 搜索相似文档
|
||||
*/
|
||||
@GetMapping("/similar")
|
||||
public Result<List<VectorSearchService.SearchResult>> searchSimilar(
|
||||
@RequestParam("query") String query,
|
||||
@RequestParam(value = "topK", defaultValue = "5") int topK,
|
||||
@RequestParam(value = "category", required = false) String category
|
||||
) {
|
||||
try {
|
||||
log.info("收到检索请求,query: {}, topK: {}, category: {}", query, topK, category);
|
||||
List<VectorSearchService.SearchResult> results = vectorSearchService.searchSimilarDocuments(query, topK, category);
|
||||
log.info("检索完成,返回 {} 条结果", results.size());
|
||||
return Result.success(results);
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("检索失败", e);
|
||||
return Result.error(500, "检索失败: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user