Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@ We will use the **Google Maps Scraper** actor (`compass/crawler-google-places`)
2. Create a new **Workflow** from Blank.
3. Click on the **+** button followed by **Tools -> Apify -> Run Actor**.

![Dify Workflow Start](docs/images/dify-workflow-start.png)
<img
src="https://raw.githubusercontent.com/apify/apify-dify-integration/main/docs/images/dify-workflow-start.png"
alt="Start Dify Workflow"
/>

4. Fill in the following settings:
- **Actor ID**: `compass/crawler-google-places`
Expand All @@ -139,7 +142,10 @@ We will use the **Google Maps Scraper** actor (`compass/crawler-google-places`)
- **Wait for Finish**:
Set to `false` if you want the workflow to return immediately after starting or to `true` if you want to wait for the run to reach a terminal state (e.g SUCCEEDED, FAILED).

![Dify Actor Run](docs/images/dify-configure-actor-run.png)
<img
src="https://raw.githubusercontent.com/apify/apify-dify-integration/main/docs/images/dify-configure-actor-run.png"
alt="Configure Actor Run"
/>

### Step 3: Connect Workflow Blocks
1. Select **Output** block in a workflow.
Expand All @@ -148,7 +154,10 @@ We will use the **Google Maps Scraper** actor (`compass/crawler-google-places`)
- Open the output of the **Output** block.
- Add a variable, e.g., `result`, that maps to the actor’s response.

![Dify Actor Run](docs/images/dify-configure-end-node.png)
<img
src="https://raw.githubusercontent.com/apify/apify-dify-integration/main/docs/images/dify-configure-end-node.png"
alt="Configure End Node"
/>

### Step 4: Run the Workflow
1. Click the **Run** button.
Expand Down
4 changes: 2 additions & 2 deletions tools/run_actor_task.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ parameters:
en_US: Input
default: "{}"
human_description:
en_US: JSON input for the task run, which you can find on the task input page in Apify Console (https://console.apify.com). If empty, the run uses the input specified in the default run configuration.
llm_description: Optional. A JSON formatted string that will be merged with the Actor task's default input. Any fields provided here will override the corresponding fields in the Actor task's pre-configured input. If not provided, an empty JSON object {} will be used.
en_US: A JSON object to override the task input. Only the fields you provide are overridden; the rest stay as in the task's default configuration. Use an empty object {} if you don't want to override anything. See the task input page in Apify Console (https://console.apify.com) for the available fields.
llm_description: Optional. A JSON object that overrides the task's default input. Only the fields you provide are overridden; all other fields remain unchanged. Use {} if you don't want to override any fields.
- name: build
type: string
required: false
Expand Down
9 changes: 8 additions & 1 deletion utils/error_handling.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def validate_number(
def validate_url(url: str, param_name: str = "url") -> str:
"""
Validates that the value is a well-formed HTTP/HTTPS URL (scheme, host present, host not
starting with a dot). Raises ToolParameterValidationError if invalid.
starting with a dot, path without '..' segments). Raises ToolParameterValidationError if invalid.
"""
if url is None or not isinstance(url, str):
raise ToolParameterValidationError(f"{param_name} must be a non-empty string.")
Expand All @@ -64,6 +64,13 @@ def validate_url(url: str, param_name: str = "url") -> str:
raise ToolParameterValidationError(
f"{param_name} is not a valid URL (host must not start with a dot)."
)

for segment in parsed.path.split("/"):
if segment.startswith(".."):
raise ToolParameterValidationError(
f"{param_name} is not a valid URL (path segments must not start with '..')."
)

return url


Expand Down
Loading