00c4c13283
build / build (push) Successful in 1m19s
列表正文改为按需读取;保留完整导出、版本隔离和有效标签筛选。 验证:前端全量、Go全量及隔离PG全mirror竞态通过;覆盖首批回调、续载失败与筛选分页。
30 lines
782 B
Go
30 lines
782 B
Go
package httpapi
|
|
|
|
import "knowledge-governance/internal/dobotaiops"
|
|
|
|
func qaPreviewText(s string) string {
|
|
r := []rune(s)
|
|
if len(r) > 400 {
|
|
return string(r[:400]) + "…"
|
|
}
|
|
return s
|
|
}
|
|
|
|
// Summaries never replace immutable business content or a full export response.
|
|
func qaRecordPreview(item dobotaiops.Record) dobotaiops.Record {
|
|
item.ContentProjection = "summary"
|
|
item.Question = qaPreviewText(item.Question)
|
|
item.Answer = qaPreviewText(item.Answer)
|
|
fields := make(map[string]string, len(item.MasterFields))
|
|
for key, value := range item.MasterFields {
|
|
if key == "question" || key == "answer" || key == "question_chinese" {
|
|
value = qaPreviewText(value)
|
|
}
|
|
fields[key] = value
|
|
}
|
|
item.MasterFields = fields
|
|
item.References = nil
|
|
item.Media = nil
|
|
return item
|
|
}
|