feat: Add AI Market Research module - Introduced Automated Market Analysis and Competitive Intelligence feature - Added 'Market Research' view to Sidebar and main navigation - Implemented MarketResearcher component with price comparison matrix and feature tables - Updated Ollama, Qwen, and Z.AI services to support market research generation - Added localized translations in English, Russian, and Hebrew
This commit is contained in:
@@ -11,6 +11,7 @@ export const translations = {
|
||||
slidesGen: "Slides Gen",
|
||||
googleAds: "Google Ads",
|
||||
uxDesigner: "UX Designer",
|
||||
marketResearch: "Market Research",
|
||||
settings: "Settings",
|
||||
history: "History",
|
||||
},
|
||||
@@ -123,6 +124,20 @@ export const translations = {
|
||||
generating: "Crafting your story...",
|
||||
emptyState: "Your presentation will appear here",
|
||||
attachFiles: "Attach files for context",
|
||||
},
|
||||
marketResearch: {
|
||||
title: "AI Market Research",
|
||||
description: "Automated competitive intelligence and market analysis",
|
||||
websiteUrl: "Company Website",
|
||||
websitePlaceholder: "Primary company website (e.g., mysite.com)",
|
||||
additionalUrls: "Additional Page URLs (optional)",
|
||||
competitors: "Competitor Websites (3-10 recommended)",
|
||||
competitorPlaceholder: "Competitor URL (e.g., competitor.com)",
|
||||
productMapping: "Product/Service Comparison",
|
||||
mappingPlaceholder: "Product Name/Category",
|
||||
generate: "Start Research",
|
||||
researching: "Performing Deep Analysis...",
|
||||
emptyState: "Your comprehensive market research report will appear here",
|
||||
}
|
||||
},
|
||||
ru: {
|
||||
@@ -135,6 +150,7 @@ export const translations = {
|
||||
slidesGen: "Генератор слайдов",
|
||||
googleAds: "Google Реклама",
|
||||
uxDesigner: "UX Дизайнер",
|
||||
marketResearch: "Анализ рынка",
|
||||
settings: "Настройки",
|
||||
history: "История",
|
||||
},
|
||||
@@ -247,6 +263,20 @@ export const translations = {
|
||||
generating: "Создаем вашу историю...",
|
||||
emptyState: "Ваша презентация появится здесь",
|
||||
attachFiles: "Прикрепить файлы для контекста",
|
||||
},
|
||||
marketResearch: {
|
||||
title: "ИИ Анализ рынка",
|
||||
description: "Автоматизированная конкурентная разведка и анализ рынка",
|
||||
websiteUrl: "Сайт вашей компании",
|
||||
websitePlaceholder: "Основной сайт компании (напр., mysite.ru)",
|
||||
additionalUrls: "Дополнительные URL (необязательно)",
|
||||
competitors: "Сайты конкурентов (рекомендуется 3-10)",
|
||||
competitorPlaceholder: "URL конкурента (напр., competitor.ru)",
|
||||
productMapping: "Сравнение продуктов/услуг",
|
||||
mappingPlaceholder: "Название/Категория продукта",
|
||||
generate: "Начать исследование",
|
||||
researching: "Выполнение глубокого анализа...",
|
||||
emptyState: "Ваш подробный отчет об исследовании рынка появится здесь",
|
||||
}
|
||||
},
|
||||
he: {
|
||||
@@ -259,6 +289,7 @@ export const translations = {
|
||||
slidesGen: "מחולל מצגות",
|
||||
googleAds: "Google Ads",
|
||||
uxDesigner: "מעצב UX",
|
||||
marketResearch: "מחקר שוק",
|
||||
settings: "הגדרות",
|
||||
history: "היסטוריה",
|
||||
},
|
||||
@@ -371,6 +402,20 @@ export const translations = {
|
||||
generating: "יוצר את הסיפור שלך...",
|
||||
emptyState: "המצגת שלך תופיע כאן",
|
||||
attachFiles: "צרף קבצים להקשר",
|
||||
},
|
||||
marketResearch: {
|
||||
title: "מחקר שוק AI",
|
||||
description: "מודיעין תחרותי וניתוח שוק אוטומטי",
|
||||
websiteUrl: "אתר החברה",
|
||||
websitePlaceholder: "אתר החברה הראשי (למשל: mysite.co.il)",
|
||||
additionalUrls: "כתובות URL נוספות (אופציונלי)",
|
||||
competitors: "אתרי מתחרים (מומלץ 3-10)",
|
||||
competitorPlaceholder: "URL של מתחרה (למשל: competitor.com)",
|
||||
productMapping: "השוואת מוצרים/שירותים",
|
||||
mappingPlaceholder: "שם המוצר/קטגוריה",
|
||||
generate: "התחל מחקר",
|
||||
researching: "מבצע ניתוח מעמיק...",
|
||||
emptyState: "דו\"ח מחקר השוק המקיף שלך יופיע כאן",
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -240,6 +240,22 @@ export class ModelAdapter {
|
||||
return this.callWithFallback((service) => service.generateMagicWand(websiteUrl, product, budget, specialInstructions, model), providers);
|
||||
}
|
||||
|
||||
async generateMarketResearch(
|
||||
options: {
|
||||
websiteUrl: string;
|
||||
additionalUrls?: string[];
|
||||
competitors: string[];
|
||||
productMapping: string;
|
||||
specialInstructions?: string;
|
||||
},
|
||||
provider?: ModelProvider,
|
||||
model?: string
|
||||
): Promise<APIResponse<string>> {
|
||||
const fallback = this.buildFallbackProviders(this.preferredProvider, "qwen", "ollama", "zai");
|
||||
const providers: ModelProvider[] = provider ? [provider] : fallback;
|
||||
return this.callWithFallback((service) => service.generateMarketResearch(options, model), providers);
|
||||
}
|
||||
|
||||
|
||||
async chatCompletion(
|
||||
messages: ChatMessage[],
|
||||
|
||||
@@ -606,6 +606,80 @@ Perform a DEEP 360° competitive intelligence analysis and generate 5-7 strategi
|
||||
|
||||
return this.chatCompletion([systemMessage, userMessage], model || "gpt-oss:120b");
|
||||
}
|
||||
|
||||
async generateMarketResearch(
|
||||
options: {
|
||||
websiteUrl: string;
|
||||
additionalUrls?: string[];
|
||||
competitors: string[];
|
||||
productMapping: string;
|
||||
specialInstructions?: string;
|
||||
},
|
||||
model?: string
|
||||
): Promise<APIResponse<string>> {
|
||||
const { websiteUrl, additionalUrls = [], competitors = [], productMapping, specialInstructions = "" } = options;
|
||||
|
||||
const systemMessage: ChatMessage = {
|
||||
role: "system",
|
||||
content: `You are a WORLD-CLASS Market Research Analyst and Competitive Intelligence Expert. Your task is to perform a deep-dive automated market analysis and competitive intelligence gathering.
|
||||
|
||||
OUTPUT FORMAT - Return ONLY valid JSON with this structure:
|
||||
\`\`\`json
|
||||
{
|
||||
"executiveSummary": "High-level overview of findings",
|
||||
"priceComparisonMatrix": [
|
||||
{
|
||||
"product": "Product Name",
|
||||
"userPrice": "$XX.XX",
|
||||
"competitorPrices": [
|
||||
{ "competitor": "Competitor Name", "price": "$XX.XX" }
|
||||
]
|
||||
}
|
||||
],
|
||||
"featureComparisonTable": [
|
||||
{
|
||||
"feature": "Feature Name",
|
||||
"userStatus": "Yes/No or description",
|
||||
"competitorStatus": [
|
||||
{ "competitor": "Competitor Name", "status": "Yes/No or description" }
|
||||
]
|
||||
}
|
||||
],
|
||||
"marketPositioning": {
|
||||
"landscape": "Current market landscape description",
|
||||
"segmentation": "Target market segments"
|
||||
},
|
||||
"competitiveAnalysis": {
|
||||
"advantages": ["Point 1", "Point 2"],
|
||||
"disadvantages": ["Point 1", "Point 2"]
|
||||
},
|
||||
"recommendations": ["Rec 1", "Rec 2"],
|
||||
"methodology": "How the research was conducted"
|
||||
}
|
||||
\`\`\`
|
||||
|
||||
REQUIREMENTS:
|
||||
- Analysis must be based on the provided website and competitor URLs.
|
||||
- Price comparison should be as realistic as possible based on industry knowledge.
|
||||
- Feature table should focus on core technical and business value.
|
||||
- Competitive analysis must highlight USP (Unique Selling Proposition).`,
|
||||
};
|
||||
|
||||
const userMessage: ChatMessage = {
|
||||
role: "user",
|
||||
content: `🔬 MARKET RESEARCH REQUEST 🔬
|
||||
|
||||
PRIMARY WEBSITE: ${websiteUrl}
|
||||
ADDITIONAL PAGES: ${additionalUrls.join(", ")}
|
||||
COMPETITORS: ${competitors.join(", ")}
|
||||
PRODUCT COMPARISON MAPPING: ${productMapping}
|
||||
${specialInstructions ? `CUSTOM PARAMETERS: ${specialInstructions}` : ""}
|
||||
|
||||
Please conduct a comprehensive competitive analysis and market research report.`,
|
||||
};
|
||||
|
||||
return this.chatCompletion([systemMessage, userMessage], model || "gpt-oss:120b");
|
||||
}
|
||||
}
|
||||
|
||||
export default OllamaCloudService;
|
||||
|
||||
@@ -934,6 +934,55 @@ Perform a DEEP 360° competitive intelligence analysis and generate 5-7 strategi
|
||||
return this.chatCompletion([systemMessage, userMessage], model || "coder-model");
|
||||
}
|
||||
|
||||
async generateMarketResearch(
|
||||
options: {
|
||||
websiteUrl: string;
|
||||
additionalUrls?: string[];
|
||||
competitors: string[];
|
||||
productMapping: string;
|
||||
specialInstructions?: string;
|
||||
},
|
||||
model?: string
|
||||
): Promise<APIResponse<string>> {
|
||||
const { websiteUrl, additionalUrls = [], competitors = [], productMapping, specialInstructions = "" } = options;
|
||||
|
||||
const systemMessage: ChatMessage = {
|
||||
role: "system",
|
||||
content: `You are a WORLD-CLASS Market Research Analyst. Perform a deep-dive automated market analysis.
|
||||
|
||||
OUTPUT FORMAT - JSON:
|
||||
{
|
||||
"executiveSummary": "findings",
|
||||
"priceComparisonMatrix": [
|
||||
{ "product": "P", "userPrice": "$", "competitorPrices": [{ "competitor": "C", "price": "$" }] }
|
||||
],
|
||||
"featureComparisonTable": [
|
||||
{ "feature": "F", "userStatus": "status", "competitorStatus": [{ "competitor": "C", "status": "status" }] }
|
||||
],
|
||||
"marketPositioning": { "landscape": "LS", "segmentation": "SG" },
|
||||
"competitiveAnalysis": { "advantages": [], "disadvantages": [] },
|
||||
"recommendations": [],
|
||||
"methodology": "method"
|
||||
}
|
||||
|
||||
REQUIREMENTS: Use provided URLs. Be realistic.`,
|
||||
};
|
||||
|
||||
const userMessage: ChatMessage = {
|
||||
role: "user",
|
||||
content: `🔬 MARKET RESEARCH REQUEST 🔬
|
||||
WEBSITE: ${websiteUrl}
|
||||
PAGES: ${additionalUrls.join(", ")}
|
||||
COMPETITORS: ${competitors.join(", ")}
|
||||
MAPPING: ${productMapping}
|
||||
${specialInstructions ? `CUSTOM: ${specialInstructions}` : ""}
|
||||
|
||||
Perform analysis based on provided instructions.`,
|
||||
};
|
||||
|
||||
return this.chatCompletion([systemMessage, userMessage], model || "coder-model");
|
||||
}
|
||||
|
||||
async listModels(): Promise<APIResponse<string[]>> {
|
||||
const models = [
|
||||
"coder-model",
|
||||
|
||||
@@ -687,6 +687,78 @@ MISSION: Perform a DEEP 360° competitive intelligence analysis and generate 5-7
|
||||
|
||||
return this.chatCompletion([systemMessage, userMessage], model || "glm-4.7", true);
|
||||
}
|
||||
|
||||
async generateMarketResearch(
|
||||
options: {
|
||||
websiteUrl: string;
|
||||
additionalUrls?: string[];
|
||||
competitors: string[];
|
||||
productMapping: string;
|
||||
specialInstructions?: string;
|
||||
},
|
||||
model?: string
|
||||
): Promise<APIResponse<string>> {
|
||||
const { websiteUrl, additionalUrls = [], competitors = [], productMapping, specialInstructions = "" } = options;
|
||||
|
||||
const systemMessage: ChatMessage = {
|
||||
role: "system",
|
||||
content: `You are a WORLD-CLASS Market Research Analyst and Competitive Intelligence Expert. Perform a deep-dive automated market analysis.
|
||||
|
||||
OUTPUT FORMAT - Return ONLY valid JSON with this structure:
|
||||
\`\`\`json
|
||||
{
|
||||
"executiveSummary": "High-level overview of findings",
|
||||
"priceComparisonMatrix": [
|
||||
{
|
||||
"product": "Product Name",
|
||||
"userPrice": "$XX.XX",
|
||||
"competitorPrices": [
|
||||
{ "competitor": "Competitor Name", "price": "$XX.XX" }
|
||||
]
|
||||
}
|
||||
],
|
||||
"featureComparisonTable": [
|
||||
{
|
||||
"feature": "Feature Name",
|
||||
"userStatus": "Yes/No or description",
|
||||
"competitorStatus": [
|
||||
{ "competitor": "Competitor Name", "status": "Yes/No or description" }
|
||||
]
|
||||
}
|
||||
],
|
||||
"marketPositioning": {
|
||||
"landscape": "Current market landscape description",
|
||||
"segmentation": "Target market segments"
|
||||
},
|
||||
"competitiveAnalysis": {
|
||||
"advantages": ["Point 1", "Point 2"],
|
||||
"disadvantages": ["Point 1", "Point 2"]
|
||||
},
|
||||
"recommendations": ["Rec 1", "Rec 2"],
|
||||
"methodology": "How the research was conducted"
|
||||
}
|
||||
\`\`\`
|
||||
|
||||
REQUIREMENTS:
|
||||
- Focus on accuracy and actionable intelligence.
|
||||
- Be realistic with price and feature estimates based on the provided URLs.`,
|
||||
};
|
||||
|
||||
const userMessage: ChatMessage = {
|
||||
role: "user",
|
||||
content: `🔬 MARKET RESEARCH REQUEST 🔬
|
||||
|
||||
PRIMARY WEBSITE: ${websiteUrl}
|
||||
ADDITIONAL PAGES: ${additionalUrls.join(", ")}
|
||||
COMPETITORS: ${competitors.join(", ")}
|
||||
PRODUCT COMPARISON MAPPING: ${productMapping}
|
||||
${specialInstructions ? `CUSTOM PARAMETERS: ${specialInstructions}` : ""}
|
||||
|
||||
Perform a COMPREHENSIVE competitive intelligence analysis.`,
|
||||
};
|
||||
|
||||
return this.chatCompletion([systemMessage, userMessage], model || "glm-4.7", true);
|
||||
}
|
||||
}
|
||||
|
||||
export default ZaiPlanService;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { create } from "zustand";
|
||||
import type { ModelProvider, PromptEnhancement, PRD, ActionPlan, SlidesPresentation, GoogleAdsResult, MagicWandResult } from "@/types";
|
||||
import type { ModelProvider, PromptEnhancement, PRD, ActionPlan, SlidesPresentation, GoogleAdsResult, MagicWandResult, MarketResearchResult, AppView } from "@/types";
|
||||
|
||||
interface AppState {
|
||||
currentPrompt: string;
|
||||
@@ -9,6 +9,7 @@ interface AppState {
|
||||
slidesPresentation: SlidesPresentation | null;
|
||||
googleAdsResult: GoogleAdsResult | null;
|
||||
magicWandResult: MagicWandResult | null;
|
||||
marketResearchResult: MarketResearchResult | null;
|
||||
language: "en" | "ru" | "he";
|
||||
selectedProvider: ModelProvider;
|
||||
selectedModels: Record<ModelProvider, string>;
|
||||
@@ -34,6 +35,7 @@ interface AppState {
|
||||
setSlidesPresentation: (slides: SlidesPresentation | null) => void;
|
||||
setGoogleAdsResult: (result: GoogleAdsResult | null) => void;
|
||||
setMagicWandResult: (result: MagicWandResult | null) => void;
|
||||
setMarketResearchResult: (result: MarketResearchResult | null) => void;
|
||||
setLanguage: (lang: "en" | "ru" | "he") => void;
|
||||
setSelectedProvider: (provider: ModelProvider) => void;
|
||||
setSelectedModel: (provider: ModelProvider, model: string) => void;
|
||||
@@ -55,6 +57,7 @@ const useStore = create<AppState>((set) => ({
|
||||
slidesPresentation: null,
|
||||
googleAdsResult: null,
|
||||
magicWandResult: null,
|
||||
marketResearchResult: null,
|
||||
language: "en",
|
||||
selectedProvider: "qwen",
|
||||
selectedModels: {
|
||||
@@ -83,6 +86,7 @@ const useStore = create<AppState>((set) => ({
|
||||
setSlidesPresentation: (slides) => set({ slidesPresentation: slides }),
|
||||
setGoogleAdsResult: (result) => set({ googleAdsResult: result }),
|
||||
setMagicWandResult: (result) => set({ magicWandResult: result }),
|
||||
setMarketResearchResult: (result) => set({ marketResearchResult: result }),
|
||||
setLanguage: (lang) => set({ language: lang }),
|
||||
setSelectedProvider: (provider) => set({ selectedProvider: provider }),
|
||||
setSelectedModel: (provider, model) =>
|
||||
@@ -121,6 +125,7 @@ const useStore = create<AppState>((set) => ({
|
||||
slidesPresentation: null,
|
||||
googleAdsResult: null,
|
||||
magicWandResult: null,
|
||||
marketResearchResult: null,
|
||||
error: null,
|
||||
}),
|
||||
}));
|
||||
|
||||
Reference in New Issue
Block a user