MCPcopy Create free account
hub / github.com/53AI/53AIHub / hashIDsInStepData

Function hashIDsInStepData

api/controller/relay/relay_process_step.go:220–253  ·  view source on GitHub ↗

hashIDsInStepData 对步骤数据中的ID字段进行hash化处理

(data map[string]interface{})

Source from the content-addressed store, hash-verified

218
219// hashIDsInStepData 对步骤数据中的ID字段进行hash化处理
220func hashIDsInStepData(data map[string]interface{}) map[string]interface{} {
221 hashedData := make(map[string]interface{})
222
223 for key, value := range data {
224 switch key {
225 case "knowledge_base_ids":
226 // 处理知识库ID数组
227 if ids, ok := value.([]int64); ok {
228 hashedData[key] = hashInt64Slice(ids)
229 } else {
230 hashedData[key] = value
231 }
232 case "sources":
233 // 处理sources数组,其中每个source都包含ID字段
234 if sources, ok := value.([]rag.SourceReference); ok {
235 hashedData[key] = hashSourcesArray(sources)
236 } else {
237 hashedData[key] = value
238 }
239 case "unique_documents":
240 // 处理去重文档数组
241 if docs, ok := value.([]UniqueDocumentInfo); ok {
242 hashedData[key] = hashUniqueDocumentsArray(docs)
243 } else {
244 hashedData[key] = value
245 }
246 default:
247 // 其他字段保持不变
248 hashedData[key] = value
249 }
250 }
251
252 return hashedData
253}
254
255func (ps *ProcessSender) SendStartWebSearchStep() error {
256 step1 := ProcessStep{

Callers 1

normalizeProcessStepFunction · 0.85

Calls 3

hashInt64SliceFunction · 0.85
hashSourcesArrayFunction · 0.85
hashUniqueDocumentsArrayFunction · 0.85

Tested by

no test coverage detected