( parts: ContentPart[], sessionId: string, agentId: string, baseUrl: string, )
| 70 | } |
| 71 | |
| 72 | function 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 | |
| 95 | export function isSafeBlobHash(hash: string): boolean { |
| 96 | return /^[a-f0-9]{64}$/.test(hash); |
no test coverage detected