mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-13 08:15:21 +02:00
feat: support {{variable}} in HTTP tool URL and add variable extraction timing option
- Apply render_template() to the endpoint URL at runtime so
{{initial_context.*}} and {{gathered_context.*}} work in URL
paths (same logic as node prompts and preset parameters).
- Update URL validation to allow template variables in the path
but reject them in the domain.
- Add variable_extraction_timing setting (before/after/both) to
HTTP tools, controlling when conversation variable extraction
runs relative to the tool call.
- Add Variable Extraction Timing radio group to the tool Settings
tab with Before/After/Both options.
This commit is contained in:
parent
49fcb770a4
commit
66bc5d3e60
4 changed files with 95 additions and 0 deletions
|
|
@ -378,6 +378,14 @@ class CustomToolManager:
|
|||
)
|
||||
)
|
||||
|
||||
# Determine when to run variable extraction relative to the tool call
|
||||
extraction_timing = config.get("variable_extraction_timing", "before")
|
||||
|
||||
if extraction_timing in ("before", "both"):
|
||||
await self._engine._perform_variable_extraction_if_needed(
|
||||
self._engine._current_node, run_in_background=False
|
||||
)
|
||||
|
||||
result = await execute_http_tool(
|
||||
tool=tool,
|
||||
arguments=function_call_params.arguments,
|
||||
|
|
@ -386,6 +394,11 @@ class CustomToolManager:
|
|||
organization_id=await self.get_organization_id(),
|
||||
)
|
||||
|
||||
if extraction_timing in ("after", "both"):
|
||||
await self._engine._perform_variable_extraction_if_needed(
|
||||
self._engine._current_node, run_in_background=False
|
||||
)
|
||||
|
||||
await function_call_params.result_callback(result)
|
||||
|
||||
except Exception as e:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue