feat: 更新支付模块 (Stripe/PayPal/PingPong) 和 uni-app 配置
This commit is contained in:
@@ -92,6 +92,61 @@ URL: {company_url}
|
||||
logger.warning(f"Analysis AI parse failed: {e}")
|
||||
return self._template_analysis(company_url)
|
||||
|
||||
async def market_intel(self, product_description: str, target_market: str) -> Dict[str, Any]:
|
||||
queries = self._build_queries(product_description, target_market)
|
||||
search_results = await self._web_search_all(queries[:3])
|
||||
companies = search_results.get("results", [])[:10] if search_results else []
|
||||
|
||||
if not self._ai_available:
|
||||
return {
|
||||
"market": target_market,
|
||||
"product": product_description,
|
||||
"trends": [],
|
||||
"competitors": [],
|
||||
"opportunities": "找到 {} 家潜在客户".format(len(companies)),
|
||||
}
|
||||
|
||||
company_summary = "\n".join(
|
||||
f"- {c.get('title','')}: {c.get('snippet','')[:200]}"
|
||||
for c in companies[:5]
|
||||
)
|
||||
|
||||
prompt = f"""产品: {product_description}
|
||||
目标市场: {target_market}
|
||||
|
||||
搜索到的相关公司:
|
||||
{company_summary}
|
||||
|
||||
请提供该市场的详细分析报告,以 JSON 格式返回:
|
||||
{{
|
||||
"market_size": "市场规模评估",
|
||||
"trends": ["趋势1", "趋势2", "趋势3"],
|
||||
"competitors": [{{"name": "竞品名", "strength": "优势", "weakness": "劣势"}}],
|
||||
"opportunities": ["机会点1", "机会点2"],
|
||||
"challenges": ["挑战1", "挑战2"],
|
||||
"entry_strategy": "进入市场建议",
|
||||
"price_range": "价格区间参考",
|
||||
"regulatory_notes": "法规注意事项"
|
||||
}}"""
|
||||
|
||||
try:
|
||||
result = await self.ai.chat(prompt,
|
||||
system_prompt="你是资深国际贸易市场分析师。只返回 JSON,不要其他内容。")
|
||||
content = result.get("reply", "")
|
||||
parsed = self._extract_json(content)
|
||||
if not parsed:
|
||||
raise ValueError("Failed to parse AI response")
|
||||
return {**parsed, "market": target_market, "product": product_description}
|
||||
except Exception as e:
|
||||
logger.error(f"Market intel failed: {e}")
|
||||
return {
|
||||
"market": target_market,
|
||||
"product": product_description,
|
||||
"trends": ["分析暂时不可用"],
|
||||
"competitors": [],
|
||||
"opportunities": f"找到 {len(companies)} 家相关公司",
|
||||
}
|
||||
|
||||
async def outreach(self, company_info: Dict[str, Any], product_info: Dict[str, Any]) -> Dict[str, Any]:
|
||||
if not self._ai_available:
|
||||
return self._template_outreach(company_info, product_info)
|
||||
|
||||
Reference in New Issue
Block a user