重构: df-ai-core trait下沉拆crate+导入历史项目批量扫描
This commit is contained in:
@@ -13,6 +13,39 @@ export interface ImportProjectInput {
|
||||
stack?: string
|
||||
}
|
||||
|
||||
/** 扫描发现的候选项目(规则发现,无 LLM)。前端预览表格只读展示。 */
|
||||
export interface ScannedProjectItem {
|
||||
path: string
|
||||
name: string
|
||||
stack: string[]
|
||||
is_monorepo: boolean
|
||||
/** 该目录是否已被某项目绑定(防重复,前端标记禁选) */
|
||||
already_bound: boolean
|
||||
}
|
||||
|
||||
/** 批量导入单条入参 */
|
||||
export interface ImportBatchItemInput {
|
||||
path: string
|
||||
/** 项目名(可选,空=用目录名) */
|
||||
name?: string
|
||||
}
|
||||
|
||||
/** 批量导入单条结果 */
|
||||
export interface ImportBatchItemResult {
|
||||
path: string
|
||||
/** 成功:导入的项目名;失败:null */
|
||||
name: string | null
|
||||
/** 失败原因(成功为 null) */
|
||||
error: string | null
|
||||
}
|
||||
|
||||
/** 批量导入结果(前端 toast 汇总) */
|
||||
export interface ImportBatchResult {
|
||||
imported: number
|
||||
skipped: number
|
||||
items: ImportBatchItemResult[]
|
||||
}
|
||||
|
||||
export const projectApi = {
|
||||
list(): Promise<ProjectRecord[]> {
|
||||
return invoke('list_projects')
|
||||
@@ -75,4 +108,20 @@ export const projectApi = {
|
||||
scanWithAi(path: string): Promise<AiScanResult> {
|
||||
return invoke('scan_project_with_ai', { path })
|
||||
},
|
||||
|
||||
/**
|
||||
* 扫描根目录发现候选项目(规则发现,快、不跑 LLM)。
|
||||
* 返回含 monorepo 子项目展开结果,前端预览表格勾选后调 importProjectsBatch。
|
||||
*/
|
||||
scanDirectoryForProjects(rootPath: string): Promise<ScannedProjectItem[]> {
|
||||
return invoke('scan_directory_for_projects', { rootPath })
|
||||
},
|
||||
|
||||
/**
|
||||
* 批量导入历史项目 — 对勾选项并发 LLM 抽 description + 入库绑定。
|
||||
* 每项独立非原子,逐项结果回传。LLM 失败 description 留空(不喂噪音)。
|
||||
*/
|
||||
importProjectsBatch(items: ImportBatchItemInput[]): Promise<ImportBatchResult> {
|
||||
return invoke('import_projects_batch', { items })
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user