MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / rehydrateParts

Function rehydrateParts

apps/vis/server/src/lib/blob-resolver.ts:72–93  ·  view source on GitHub ↗
(
  parts: ContentPart[],
  sessionId: string,
  agentId: string,
  baseUrl: string,
)

Source from the content-addressed store, hash-verified

70}
71
72function rehydrateParts(
73 parts: ContentPart[],
74 sessionId: string,
75 agentId: string,
76 baseUrl: string,
77): void {
78 for (const part of parts) {
79 switch (part.type) {
80 case 'image_url':
81 part.imageUrl.url = resolveBlobRefUrl(part.imageUrl.url, sessionId, agentId, baseUrl);
82 break;
83 case 'audio_url':
84 part.audioUrl.url = resolveBlobRefUrl(part.audioUrl.url, sessionId, agentId, baseUrl);
85 break;
86 case 'video_url':
87 part.videoUrl.url = resolveBlobRefUrl(part.videoUrl.url, sessionId, agentId, baseUrl);
88 break;
89 default:
90 break;
91 }
92 }
93}
94
95export function isSafeBlobHash(hash: string): boolean {
96 return /^[a-f0-9]{64}$/.test(hash);

Callers 1

rehydrateRecordFunction · 0.85

Calls 1

resolveBlobRefUrlFunction · 0.85

Tested by

no test coverage detected