feat: target channel context history, custom website extraction needs, and categorized main menu
This commit is contained in:
@@ -38,7 +38,7 @@ class WebsiteAnalyzer:
|
||||
def __init__(self, llm: LLMClient):
|
||||
self.llm = llm
|
||||
|
||||
async def analyze_website(self, url: str) -> Tuple[bool, Dict[str, Any], str]:
|
||||
async def analyze_website(self, url: str, custom_instructions: str = "") -> Tuple[bool, Dict[str, Any], str]:
|
||||
"""Discover endpoints and prompt AI to build the extractor schema."""
|
||||
clean_url = url.strip()
|
||||
if not clean_url.startswith("http://") and not clean_url.startswith("https://"):
|
||||
@@ -109,11 +109,14 @@ class WebsiteAnalyzer:
|
||||
except Exception as e:
|
||||
return False, {}, f"خطا در برقراری ارتباط با وبسایت: {e}"
|
||||
|
||||
custom_block = f"\nUser Extraction Needs / Filtering Instructions:\n{custom_instructions.strip()}\n" if custom_instructions and custom_instructions.strip() else ""
|
||||
|
||||
prompt = (
|
||||
f"Website Target URL: {clean_url}\n"
|
||||
f"{custom_block}"
|
||||
f"Discovery Notes:\n" + "\n".join(discovered_info) + "\n\n"
|
||||
f"Data / Feed Sample:\n{sample_data}\n\n"
|
||||
f"Determine the best endpoint_url, parser_type, and field mappings to regularly extract the latest news/articles from this site."
|
||||
f"Determine the best endpoint_url, parser_type, and field mappings to regularly extract the latest news/articles from this site matching the user requirements."
|
||||
)
|
||||
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user