fix(ui): 自定义工具表单 overflow-y-scroll→auto + 认证方式NONE翻译改为'无' + Captain文档爬虫/同步后端
This commit is contained in:
@@ -84,9 +84,14 @@ func (r *CaptainDocumentRepo) ListByAccount(ctx context.Context, accountID uint,
|
||||
}
|
||||
switch filters.Source {
|
||||
case "web":
|
||||
db = db.Where("external_link <> ''")
|
||||
// Web documents: have external_link but not a PDF.
|
||||
db = db.Where("(content_type IS NULL OR content_type = '' OR content_type != 'application/pdf') AND (file_url = '' OR file_url IS NULL) AND external_link <> ''")
|
||||
case "pdf":
|
||||
db = db.Where("external_link = ''")
|
||||
// PDF documents: identified by content_type or file_url.
|
||||
db = db.Where("content_type = 'application/pdf' OR (file_url IS NOT NULL AND file_url <> '')")
|
||||
case "text":
|
||||
// Text documents: inline content, no external link and no file.
|
||||
db = db.Where("(external_link = '' OR external_link IS NULL) AND (file_url = '' OR file_url IS NULL) AND content <> ''")
|
||||
}
|
||||
switch filters.Filter {
|
||||
case "syncing":
|
||||
@@ -95,6 +100,11 @@ func (r *CaptainDocumentRepo) ListByAccount(ctx context.Context, accountID uint,
|
||||
db = db.Where("sync_status = ?", model.DocumentSyncStatusFailed)
|
||||
case "synced":
|
||||
db = db.Where("sync_status = ?", model.DocumentSyncStatusSynced)
|
||||
case "stale":
|
||||
// Documents that need updating: never synced or explicitly marked stale,
|
||||
// excluding those currently syncing.
|
||||
db = db.Where("(last_synced_at IS NULL OR sync_status = ?) AND sync_status != ?",
|
||||
model.DocumentSyncStatusStale, model.DocumentSyncStatusPending)
|
||||
}
|
||||
if filters.SearchKey != "" {
|
||||
query := "%" + strings.ToLower(filters.SearchKey) + "%"
|
||||
|
||||
Reference in New Issue
Block a user