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
11 changes: 11 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,17 @@ def google_sites_assistance_endpoint():
return jsonify({"status": "success", "message": message})


@app.route('/api/v1/marketing/assistance', methods=['POST'])
@require_api_key
def marketing_assistance_endpoint():
data = request.get_json()
prompt = data.get('prompt')
if not prompt:
return jsonify({"error": _("Prompt is required")}), 400
message = google_ai.provide_marketing_bot_assistance(prompt)
return jsonify({"status": "success", "message": message})


@app.route('/api/v1/translate', methods=['POST'])
@require_api_key
def translate_endpoint():
Expand Down

Large diffs are not rendered by default.

89 changes: 47 additions & 42 deletions docs/assets/index-bx1vr-tI.js → docs/assets/index-DKn7X7kD.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<link rel="icon" type="image/svg+xml" href="./favicon.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Yendoukoa AI - AI Service Marketplace</title>
<script type="module" crossorigin src="./assets/index-bx1vr-tI.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-nkAf37JB.css">
<script type="module" crossorigin src="./assets/index-DKn7X7kD.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-Bze3XCEm.css">
</head>
<body>
<div id="root"></div>
Expand Down
38 changes: 38 additions & 0 deletions frontend/static/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -1591,6 +1591,44 @@ document.addEventListener('DOMContentLoaded', () => {
});
}

// --- Marketing Assistance ---
const marketingBtn = document.getElementById('marketing-btn');
if (marketingBtn) {
marketingBtn.addEventListener('click', async () => {
const input = document.getElementById('marketing-input');
const responseContainer = document.getElementById('marketing-response');
const apiKey = getApiKey("Please enter your API key to use the Digital Marketing & Bot Specialist:");

if (!apiKey) {
responseContainer.textContent = 'API key is required.';
return;
}

try {
const response = await fetch('/api/v1/marketing/assistance', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-API-Key': apiKey
},
body: JSON.stringify({
prompt: input.value
})
});

if (!response.ok) {
const error = await response.json();
throw new Error(error.error || 'Failed to get a response from the marketing specialist');
}

const result = await response.json();
responseContainer.textContent = result.message;
} catch (error) {
responseContainer.textContent = `Error: ${error.message}`;
}
});
}

// --- E-shop Assistance ---
const eshopBtn = document.getElementById('eshop-btn');
if (eshopBtn) {
Expand Down
21 changes: 21 additions & 0 deletions frontend/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<li><a href="#esports-assistance">{{ _('eSports') }}</a></li>
<li><a href="#fake-content-verification">{{ _('Verification') }}</a></li>
<li><a href="#military-assistance">{{ _('Military') }}</a></li>
<li><a href="#marketing-assistance">{{ _('Marketing') }}</a></li>
<li><a href="#purchase">{{ _('Purchase') }}</a></li>
<li><a href="#portfolio">{{ _('Portfolio') }}</a></li>
<li><a href="#contact">{{ _('Contact') }}</a></li>
Expand Down Expand Up @@ -205,6 +206,26 @@ <h3>{{ _('IT Operations Specialist') }}</h3>
<h3>{{ _('Software & Hardware Maintenance') }}</h3>
<p>{{ _('Expert assistance for software updates, computer hardware troubleshooting, and mobile phone maintenance.') }}</p>
</div>
<div class="card">
<h3>{{ _('Digital Marketing & Bot Specialist') }}</h3>
<p>{{ _('Expert assistance for e-mail, SMS, and bot marketing & management, providing strategic and technical guidance.') }}</p>
</div>
</div>
</section>

<!-- Marketing Specialist Section -->
<section id="marketing-assistance" class="services">
<h2>{{ _('Digital Marketing & Bot Specialist') }}</h2>
<div class="service-cards">
<div class="card">
<h3>{{ _('Marketing & Bot Support') }}</h3>
<p>{{ _('Enter your request for e-mail marketing, SMS campaigns, or bot management below.') }}</p>
<textarea id="marketing-input" placeholder="{{ _('Your marketing or bot request') }}" class="styled-textarea" rows="4"></textarea>
<button id="marketing-btn" class="btn">{{ _('Submit') }}</button>
<div class="response-container" id="marketing-response-container">
<pre id="marketing-response"></pre>
</div>
</div>
</div>
</section>

Expand Down
32 changes: 32 additions & 0 deletions google_ai.py
Original file line number Diff line number Diff line change
Expand Up @@ -1582,3 +1582,35 @@ def provide_google_sites_assistance(prompt: str) -> str:
except Exception as e:
print(f"Error providing Google Sites assistance with Vertex AI: {e}")
return f"Error: {e}"

def provide_marketing_bot_assistance(prompt: str) -> str:
"""
Provides assistance with e-mail, SMS, and bot marketing and management using Vertex AI.
"""
model = GenerativeModel("gemini-1.5-flash")

generation_prompt = f"""
You are an expert Digital Marketing and Bot Management Specialist.
Your task is to provide high-level strategic guidance and technical assistance for e-mail marketing, SMS campaigns, and AI bot management.
Your expertise includes:
- E-mail Marketing: Designing effective campaigns, automation workflows, list management, and improving deliverability and open rates.
- SMS Marketing: Crafting compelling SMS content, managing opt-ins/opt-outs, and implementing automated SMS sequences.
- Bot Management & Marketing: Building and managing marketing bots for platforms like WhatsApp, Telegram, and Messenger to engage customers and automate sales.
- Campaign Analytics: Analyzing performance metrics for e-mail, SMS, and bots to optimize ROI and customer engagement.
- Compliance: Advising on best practices for data privacy and anti-spam regulations (GDPR, TCPA, etc.).

User Request:
---
{prompt}
---

Provide a professional, strategic, and detailed response based on the user's request.
"""

try:
response = model.generate_content(generation_prompt)
return response.text.strip()

except Exception as e:
print(f"Error providing marketing and bot assistance with Vertex AI: {e}")
return f"Error: {e}"
9 changes: 7 additions & 2 deletions marketplace-frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ import {
Building2,
BookOpen,
Microscope,
Layout
Layout,
Mail
} from 'lucide-react';
import type { LucideIcon } from 'lucide-react';
import { userService, aiService, setAuthToken, type User } from './api';
Expand Down Expand Up @@ -60,7 +61,8 @@ const AI_SERVICES: AIService[] = [
{ id: 'verification', name: 'Content Verifier', category: 'Security', icon: ShieldCheck, description: 'AI content and fake news detection.' },
{ id: 'maintenance', name: 'Hardware Expert', category: 'Support', icon: Wrench, description: 'Software & hardware troubleshooting.' },
{ id: 'researcher', name: 'AI Researcher', category: 'Science', icon: Microscope, description: 'State-of-the-art AI methodology research.' },
{ id: 'google-sites', name: 'Google Sites Specialist', category: 'Infrastructure', icon: Layout, description: 'Google Sites & DNS configuration expert.' }
{ id: 'google-sites', name: 'Google Sites Specialist', category: 'Infrastructure', icon: Layout, description: 'Google Sites & DNS configuration expert.' },
{ id: 'marketing', name: 'Marketing & Bot Specialist', category: 'Business', icon: Mail, description: 'Expert e-mail, SMS, and bot marketing & management.' }
];

const App: React.FC = () => {
Expand Down Expand Up @@ -131,6 +133,9 @@ const App: React.FC = () => {
case 'diagnostic':
response = await aiService.getDiagnosticAssistance(servicePrompt);
break;
case 'marketing':
response = await aiService.getMarketingAssistance(servicePrompt);
break;
default:
// Fallback for demo purposes if specific endpoint isn't mapped in aiService yet
response = { data: { message: "This service is currently in demo mode. The full integration is coming soon!" } };
Expand Down
1 change: 1 addition & 0 deletions marketplace-frontend/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export const aiService = {
getFinancialAdvice: (prompt: string) => apiClient.post('/finance/advice', { prompt }),
getGoogleSitesAssistance: (prompt: string) => apiClient.post('/google-sites/assistance', { prompt }),
getDiagnosticAssistance: (prompt: string) => apiClient.post('/diagnostic/assistance', { prompt }),
getMarketingAssistance: (prompt: string) => apiClient.post('/marketing/assistance', { prompt }),
};

export const userService = {
Expand Down
42 changes: 42 additions & 0 deletions tests/test_marketing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import pytest
from app import app, db, User
import json

@pytest.fixture
def client():
app.config['TESTING'] = True
app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///:memory:'
with app.test_client() as client:
with app.app_context():
db.create_all()
yield client
db.drop_all()

def test_marketing_assistance_no_api_key(client):
response = client.post('/api/v1/marketing/assistance',
data=json.dumps({'prompt': 'test prompt'}),
content_type='application/json')
assert response.status_code == 401

def test_marketing_assistance_with_api_key(client):
with app.app_context():
user = User(username='testuser', api_key='testkey')
db.session.add(user)
db.session.commit()

# Mocking google_ai.provide_marketing_bot_assistance to avoid Vertex AI calls during tests
import google_ai
original_func = google_ai.provide_marketing_bot_assistance
google_ai.provide_marketing_bot_assistance = lambda prompt: f"Mock response for: {prompt}"

try:
response = client.post('/api/v1/marketing/assistance',
headers={'X-API-Key': 'testkey'},
data=json.dumps({'prompt': 'How to do e-mail marketing?'}),
content_type='application/json')
assert response.status_code == 200
data = json.loads(response.data)
assert data['status'] == 'success'
assert "Mock response for: How to do e-mail marketing?" in data['message']
finally:
google_ai.provide_marketing_bot_assistance = original_func
Loading