feat: add Resemble Detect + Intelligence tool#6500
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new integration for Resemble AI Detect + Intelligence, including credential configuration, a tool node, an HTTP client, and LangChain tool definitions. A critical issue was identified in the HTTP client (client.ts) where attempting to read the response as text after a failed JSON parsing attempt will throw a TypeError because the response stream is already consumed. It is recommended to read the response as text first and then parse it.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| let data: any | ||
| try { | ||
| data = await res.json() | ||
| } catch { | ||
| data = { raw: await res.text() } | ||
| } |
There was a problem hiding this comment.
In the Fetch API, once a response body has been read (even if parsing fails), the stream is fully consumed and locked. Attempting to call res.text() in the catch block after res.json() fails will throw a TypeError: body stream already read instead of retrieving the raw text.
To fix this, read the response as text first, and then attempt to parse it as JSON.
const text = await res.text()
let data: any
try {
data = JSON.parse(text)
} catch {
data = { raw: text }
}Adds a Resemble tool node (toolkit of detect / intelligence / watermark DynamicStructuredTools) and a Resemble API credential. HTTP logic in a dependency-free client.ts; async detection polls to completion.
21674cb to
d6c8adf
Compare
- read response bodies once via text() then JSON.parse — calling
res.text() after a failed res.json() throws on a consumed stream
- rPoll throws when a job does not finish within max_wait_seconds
instead of returning a non-terminal payload
- completion uses a per-resource predicate: watermark apply results
carry no status field, so done = watermarked_media/url present
- intelligence polls the documented GET /intelligences/{uuid} route
and poll errors propagate instead of being swallowed
|
Feedback addressed: response bodies are now read once via |
|
@HenryHengZJ gentle ping for a review when you have a moment — tsc/lint clean and review feedback addressed. We'd also be open to a Resemble ↔ Flowise partnership: dev.shah@resemble.ai. Thanks! |
Resemble Detect + Intelligence tool
Adds a
Resembletool node +Resemble APIcredential for Resemble AImedia safety: deepfake detection, media intelligence, and watermarking. Scope is
Detect + Intelligence only (no TTS / voice cloning).
What it adds
packages/components/nodes/tools/Resemble/— node exposing a toolkit ofDynamicStructuredTools to an agent:resemble_detect— deepfake detection (audio/image/video) with toggles forintelligence, source tracing, visualize, reverse-search, OOD, zero-retention, model type
resemble_intelligence— transcription, translation, speaker info, emotion, misinformationresemble_watermark_detect/resemble_watermark_applypackages/components/credentials/ResembleApi.credential.ts— API-key credential.Implementation
client.ts(globalfetch), wrapped bycore.tsinto LangChain tools (
@langchain/core/tools+zod/v3).Prefer: wait.Testing
The client was run live against the Resemble API: media intelligence and watermark
detect/apply confirmed green; detection uses the same submit→poll path.