@@ -1172,14 +1172,20 @@ func minInt(a, b int) int {
|
||||
}
|
||||
|
||||
func hashDoc(d model.KnowledgeDoc, cfg ScoringConfig) string {
|
||||
// Only retrieval-relevant fields belong in the embedding fingerprint.
|
||||
// Formatting-only changes to AnswerHTML must not force re-embedding.
|
||||
b, _ := json.Marshal(struct {
|
||||
Doc model.KnowledgeDoc `json:"doc"`
|
||||
Profile string `json:"profile"`
|
||||
EmbeddingIdentity string `json:"embedding_identity"`
|
||||
ChunkWords int `json:"chunk_words"`
|
||||
ChunkOverlap int `json:"chunk_overlap"`
|
||||
MaxChunks int `json:"max_chunks"`
|
||||
}{d, cfg.EmbeddingProfile, cfg.EmbeddingIdentity, cfg.ChunkWords, cfg.ChunkOverlap, cfg.MaxChunksPerDoc})
|
||||
ID string `json:"id"`
|
||||
Title string `json:"title"`
|
||||
Text string `json:"text"`
|
||||
Categories []int64 `json:"categories"`
|
||||
Keywords []string `json:"keywords"`
|
||||
Profile string `json:"profile"`
|
||||
EmbeddingIdentity string `json:"embedding_identity"`
|
||||
ChunkWords int `json:"chunk_words"`
|
||||
ChunkOverlap int `json:"chunk_overlap"`
|
||||
MaxChunks int `json:"max_chunks"`
|
||||
}{d.ID, d.Title, d.Text, d.Categories, d.Keywords, cfg.EmbeddingProfile, cfg.EmbeddingIdentity, cfg.ChunkWords, cfg.ChunkOverlap, cfg.MaxChunksPerDoc})
|
||||
h := sha256.Sum256(b)
|
||||
return hex.EncodeToString(h[:])
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user