mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-13 20:15:59 +08:00
For security. (#3642)
### What problem does this PR solve? ### Type of change - [x] Performance Improvement
This commit is contained in:
parent
32cf566a08
commit
3df1663e4f
@ -17,6 +17,7 @@ from abc import ABC
|
|||||||
import asyncio
|
import asyncio
|
||||||
from crawl4ai import AsyncWebCrawler
|
from crawl4ai import AsyncWebCrawler
|
||||||
from agent.component.base import ComponentBase, ComponentParamBase
|
from agent.component.base import ComponentBase, ComponentParamBase
|
||||||
|
from api.utils.web_utils import is_valid_url
|
||||||
|
|
||||||
|
|
||||||
class CrawlerParam(ComponentParamBase):
|
class CrawlerParam(ComponentParamBase):
|
||||||
@ -39,7 +40,7 @@ class Crawler(ComponentBase, ABC):
|
|||||||
def _run(self, history, **kwargs):
|
def _run(self, history, **kwargs):
|
||||||
ans = self.get_input()
|
ans = self.get_input()
|
||||||
ans = " - ".join(ans["content"]) if "content" in ans else ""
|
ans = " - ".join(ans["content"]) if "content" in ans else ""
|
||||||
if not ans:
|
if not is_valid_url(ans):
|
||||||
return Crawler.be_output("")
|
return Crawler.be_output("")
|
||||||
try:
|
try:
|
||||||
result = asyncio.run(self.get_web(ans))
|
result = asyncio.run(self.get_web(ans))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user