Seed 20 Odoo+AI prospects and enforce model-only chat responses

This commit is contained in:
Ruslan Bakiev
2026-02-18 21:50:41 +07:00
parent fdc85d5c42
commit 693faa8621
3 changed files with 293 additions and 157 deletions

View File

@@ -55,52 +55,44 @@ function plusMinutes(date, minutes) {
return d;
}
function buildContacts(teamId, count) {
const firstNames = [
"Alex", "Mia", "Leo", "Sofia", "Noah", "Emma", "Liam", "Ava", "Ethan", "Luna",
"Mason", "Chloe", "Logan", "Mila", "Lucas", "Nora", "Elijah", "Zoey", "James", "Aria",
"Daniel", "Nina", "Henry", "Layla", "Oliver", "Iris", "Oscar", "Diana", "Max", "Eva",
];
const lastNames = [
"Carter", "Meyer", "Ali", "Petrov", "Rivera", "Ivanova", "Fisher", "Khan", "Wright", "Cole",
"Silva", "Morris", "King", "Anderson", "Lopez", "Walker", "Young", "Scott", "Green", "Parker",
];
const companies = [
"Northline", "Connecta", "Volta", "Blueport", "Skyline", "PrimeGrid", "Helio", "CoreLabs", "NovaTrade", "Astera",
];
const locations = [
{ country: "USA", city: "New York" },
{ country: "USA", city: "Austin" },
{ country: "Germany", city: "Berlin" },
{ country: "UAE", city: "Dubai" },
{ country: "Spain", city: "Barcelona" },
{ country: "Armenia", city: "Yerevan" },
{ country: "UK", city: "London" },
{ country: "France", city: "Paris" },
{ country: "Singapore", city: "Singapore" },
{ country: "Canada", city: "Toronto" },
function buildOdooAiContacts(teamId) {
const prospects = [
{ name: "Olivia Reed", company: "RetailNova", country: "USA", location: "New York", email: "olivia.reed@retailnova.com", phone: "+1 555 120 0101" },
{ name: "Daniel Kim", company: "ForgePeak Manufacturing", country: "USA", location: "Chicago", email: "daniel.kim@forgepeak.com", phone: "+1 555 120 0102" },
{ name: "Marta Alonso", company: "Iberia Foods Group", country: "Spain", location: "Barcelona", email: "marta.alonso@iberiafoods.es", phone: "+34 91 555 0103" },
{ name: "Youssef Haddad", company: "GulfTrade Distribution", country: "UAE", location: "Dubai", email: "youssef.haddad@gulftrade.ae", phone: "+971 4 555 0104" },
{ name: "Emma Collins", company: "NorthBridge Logistics", country: "UK", location: "London", email: "emma.collins@northbridge.co.uk", phone: "+44 20 5550 0105" },
{ name: "Noah Fischer", company: "Bergmann Auto Parts", country: "Germany", location: "Munich", email: "noah.fischer@bergmann-auto.de", phone: "+49 89 5550 0106" },
{ name: "Ava Choi", company: "Pacific MedTech Supply", country: "Singapore", location: "Singapore", email: "ava.choi@pacificmedtech.sg", phone: "+65 6555 0107" },
{ name: "Liam Dubois", company: "HexaCommerce", country: "France", location: "Paris", email: "liam.dubois@hexacommerce.fr", phone: "+33 1 55 50 0108" },
{ name: "Maya Shah", company: "Zenith Consumer Brands", country: "Canada", location: "Toronto", email: "maya.shah@zenithbrands.ca", phone: "+1 416 555 0109" },
{ name: "Arman Petrosyan", company: "Ararat Electronics", country: "Armenia", location: "Yerevan", email: "arman.petrosyan@ararat-electronics.am", phone: "+374 10 555110" },
{ name: "Sophia Martinez", company: "Sunline Home Goods", country: "USA", location: "Austin", email: "sophia.martinez@sunlinehg.com", phone: "+1 555 120 0111" },
{ name: "Leo Novak", company: "CentralBuild Materials", country: "Germany", location: "Berlin", email: "leo.novak@centralbuild.de", phone: "+49 30 5550 0112" },
{ name: "Isla Grant", company: "BlueHarbor Pharma", country: "UK", location: "Manchester", email: "isla.grant@blueharbor.co.uk", phone: "+44 161 555 0113" },
{ name: "Mateo Rossi", company: "Milano Fashion House", country: "Italy", location: "Milan", email: "mateo.rossi@milanofh.it", phone: "+39 02 5550 0114" },
{ name: "Nina Volkova", company: "Polar AgriTech", country: "Kazakhstan", location: "Almaty", email: "nina.volkova@polaragri.kz", phone: "+7 727 555 0115" },
{ name: "Ethan Park", company: "Vertex Components", country: "South Korea", location: "Seoul", email: "ethan.park@vertexcomponents.kr", phone: "+82 2 555 0116" },
{ name: "Zara Khan", company: "Crescent Retail Chain", country: "UAE", location: "Abu Dhabi", email: "zara.khan@crescentretail.ae", phone: "+971 2 555 0117" },
{ name: "Hugo Silva", company: "Luso Industrial Systems", country: "Portugal", location: "Lisbon", email: "hugo.silva@lusois.pt", phone: "+351 21 555 0118" },
{ name: "Chloe Bernard", company: "Santex Clinics Network", country: "France", location: "Lyon", email: "chloe.bernard@santex.fr", phone: "+33 4 55 50 0119" },
{ name: "James Walker", company: "Metro Wholesale Group", country: "USA", location: "Los Angeles", email: "james.walker@metrowholesale.com", phone: "+1 555 120 0120" },
];
const rows = [];
for (let i = 0; i < count; i += 1) {
const first = firstNames[i % firstNames.length];
const last = lastNames[Math.floor(i / firstNames.length) % lastNames.length];
const company = `${companies[i % companies.length]} ${String.fromCharCode(65 + (i % 26))}`;
const loc = locations[i % locations.length];
const female = i % 2 === 0;
const picIdx = (i % 70) + 1;
rows.push({
return prospects.map((p, idx) => {
const female = idx % 2 === 0;
const picIdx = (idx % 70) + 1;
return {
teamId,
name: `${first} ${last} ${i + 1}`,
company,
country: loc.country,
location: loc.city,
name: p.name,
company: p.company,
country: p.country,
location: p.location,
avatarUrl: `https://randomuser.me/api/portraits/${female ? "women" : "men"}/${picIdx}.jpg`,
email: `${first.toLowerCase()}.${last.toLowerCase()}${i + 1}@${company.toLowerCase().replace(/\s+/g, "")}.example`,
phone: `+1 555 01${String(i).padStart(4, "0")}`,
});
}
return rows;
email: p.email,
phone: p.phone,
};
});
}
async function main() {
@@ -152,18 +144,27 @@ async function main() {
]);
const contacts = await prisma.contact.createManyAndReturn({
data: buildContacts(team.id, 220),
data: buildOdooAiContacts(team.id),
select: { id: true, name: true, company: true },
});
const integrationModules = [
"Sales + CRM + forecasting copilot",
"Inventory + demand prediction",
"Purchase + supplier risk scoring",
"Accounting + AI anomaly detection",
"Helpdesk + ticket triage assistant",
"Manufacturing + production planning AI",
];
await prisma.contactNote.createMany({
data: contacts.map((c, idx) => ({
contactId: c.id,
content:
`Summary for ${c.name}. Main objective: move the account to a predictable weekly rhythm. ` +
`Current context: ${c.company ?? "Account"} is active in at least one channel. ` +
`Recommended path: keep messages short, lock a concrete next step, and update the note after each interaction. ` +
`Priority signal ${idx % 5 === 0 ? "high" : "normal"}.`,
`${c.company ?? c.name} is evaluating Odoo implementation with AI extensions. ` +
`Primary integration scope: ${integrationModules[idx % integrationModules.length]}. ` +
`Main buying trigger: reduce manual operations and shorten decision cycles. ` +
`Next milestone: run discovery workshop, confirm data owners, and approve pilot KPI pack.`,
})),
});
@@ -178,7 +179,7 @@ async function main() {
kind: "MESSAGE",
direction: "IN",
channel: channels[i % channels.length],
content: `Hi, this is ${contact.name}. Can we sync on timeline this week?`,
content: `Hi, we are reviewing Odoo + AI rollout for ${contact.company}. Can we align on integration timeline this week?`,
occurredAt: base,
});
@@ -187,7 +188,7 @@ async function main() {
kind: "MESSAGE",
direction: "OUT",
channel: channels[(i + 1) % channels.length],
content: `Sure. I suggest two slots and a clear agenda.`,
content: "Sure. I suggest a 45-min discovery focused on workflows, API constraints, and pilot KPIs.",
occurredAt: plusMinutes(base, 22),
});
@@ -196,21 +197,21 @@ async function main() {
kind: "MESSAGE",
direction: i % 3 === 0 ? "OUT" : "IN",
channel: channels[(i + 2) % channels.length],
content: `Status update: legal owner and decision date are the two blockers now.`,
content: "Status update: technical scope is clear; blocker is budget owner approval and security questionnaire.",
occurredAt: plusMinutes(base, 65),
});
if (i % 4 === 0) {
if (i % 3 === 0) {
contactMessages.push({
contactId: contact.id,
kind: "CALL",
direction: "OUT",
channel: "PHONE",
content: "Voice call from CRM",
content: "Discovery call: Odoo modules, data flows, AI use-cases",
durationSec: 180 + ((i * 23) % 420),
transcriptJson: [
`${contact.name}: We need a clear owner for approval.`,
`You: Agreed, let's lock this today and set the next checkpoint.`,
`${contact.name}: We need phased rollout, starting from Sales and Inventory.`,
"You: Agreed. We can run a 6-week pilot with KPI baseline and weekly checkpoints.",
],
occurredAt: plusMinutes(base, 110),
});
@@ -226,39 +227,42 @@ async function main() {
{
teamId: team.id,
contactId: c.id,
title: `Follow-up with ${c.name}`,
title: `Discovery: Odoo + AI with ${c.company ?? c.name}`,
startsAt: firstStart,
endsAt: plusMinutes(firstStart, 30),
note: "Confirm owner, timeline, and next concrete action.",
note: "Confirm integration scope, current stack, and pilot success metrics.",
status: "planned",
},
{
teamId: team.id,
contactId: c.id,
title: `Checkpoint: ${c.company ?? c.name}`,
title: `Architecture workshop: ${c.company ?? c.name}`,
startsAt: secondStart,
endsAt: plusMinutes(secondStart, 45),
note: "Review progress and unblock pending decisions.",
note: "Review API mapping, ETL boundaries, and AI assistant guardrails.",
status: idx % 6 === 0 ? "done" : "planned",
},
];
}),
});
const stages = ["Qualification", "Proposal", "Negotiation", "Contract"];
const stages = ["Lead", "Discovery", "Solution Fit", "Proposal", "Negotiation", "Pilot", "Contract Review"];
await prisma.deal.createMany({
data: contacts
.filter((_, idx) => idx % 5 !== 0)
.map((c, idx) => ({
data: contacts.map((c, idx) => ({
teamId: team.id,
contactId: c.id,
title: `${c.company ?? "Account"} expansion`,
title: `${c.company ?? "Account"} Odoo + AI integration`,
stage: stages[idx % stages.length],
amount: 8000 + (idx % 17) * 1500,
nextStep: "Lock next sync and owner on client side.",
summary: "Deal is active. Focus on speed and explicit decision checkpoints.",
amount: 18000 + (idx % 8) * 7000,
nextStep:
idx % 4 === 0
? "Send pilot proposal and finalize integration backlog."
: "Run solution workshop and align commercial owner on timeline.",
summary:
"Potential deal for phased Odoo implementation with AI copilots for ops, sales, and planning. " +
"Commercial model: discovery + pilot + rollout.",
})),
});
});
await prisma.contactPin.createMany({
data: contacts.map((c, idx) => ({
@@ -266,8 +270,8 @@ async function main() {
contactId: c.id,
text:
idx % 3 === 0
? "Pinned: calendar event is near, prepare a concise follow-up note."
: "Pinned: keep one explicit ask in each message.",
? "Pinned: ask for ERP owner, data owner, and target go-live quarter."
: "Pinned: keep communication around one KPI and one next action.",
})),
});
@@ -281,14 +285,14 @@ async function main() {
contactId: c.id,
happenedAt: atOffset(-(idx % 6), 9 + (idx % 8), (idx * 9) % 60),
text:
`I analyzed the latest contact activity for ${c.name}. ` +
`There is enough momentum to push one concrete action now and reduce response latency.`,
`I reviewed ${c.company ?? c.name} account activity for the Odoo + AI opportunity. ` +
"There is enough momentum to move the deal one stage with a concrete next action.",
proposalJson: {
title: idx % 2 === 0 ? "Add focused follow-up event" : "Draft a concise unblock message",
title: idx % 2 === 0 ? "Schedule pilot scoping call" : "Send unblock note for budget owner",
details: [
`Contact: ${c.name}`,
idx % 2 === 0 ? "Timing: in the next 60 minutes" : "Timing: send in the primary active channel",
"Goal: lock owner and next exact date",
idx % 2 === 0 ? "Timing: this week, 45 minutes" : "Timing: today in primary channel",
"Goal: confirm scope, owner, and next commercial checkpoint",
],
key: proposalKeys[idx % proposalKeys.length],
},
@@ -299,62 +303,62 @@ async function main() {
data: [
{
teamId: team.id,
title: "Response time regulation",
title: "Odoo integration discovery checklist",
type: "Regulation",
owner: "Revenue Ops",
scope: "All active deals",
summary: "Rules for first response and follow-up SLA across channels.",
body: "## SLA\n- First response in under 30 minutes for active threads.\n- Escalate if no owner is assigned.\n\n## Rule\nAlways end a message with one explicit next step.",
owner: "Solution Team",
scope: "Pre-sale discovery",
summary: "Mandatory questions before estimation of Odoo + AI rollout.",
body: "## Must capture\n- Current ERP modules\n- Integration endpoints\n- Data owner per domain\n- Security constraints\n- Pilot KPI baseline",
updatedAt: atOffset(-1, 11, 10),
},
{
teamId: team.id,
title: "Discovery playbook",
title: "AI copilot playbook for Odoo",
type: "Playbook",
owner: "Sales Lead",
scope: "Discovery and qualification",
summary: "Consistent structure for discovery calls and follow-up notes.",
body: "## Flow\n1. Pain\n2. Impact\n3. Owner\n4. Timeline\n5. Next step\n\n## Output\nStore concise summary in the contact card.",
owner: "AI Practice Lead",
scope: "Use-case qualification",
summary: "How to position forecasting, assistant, and anomaly detection features.",
body: "## Flow\n1. Process pain\n2. Data quality\n3. Model target\n4. Success KPI\n5. Pilot scope",
updatedAt: atOffset(-2, 15, 0),
},
{
teamId: team.id,
title: "AI action policy",
title: "Pilot pricing matrix",
type: "Policy",
owner: "Founders",
scope: "AI recommendations",
summary: "What can be auto-drafted and what always needs explicit approval.",
body: "## Allowed\n- Draft suggestions\n- Summaries\n\n## Requires approval\n- Outbound send\n- Event creation\n- Deal stage change",
owner: "Commercial Ops",
scope: "Discovery and pilot contracts",
summary: "Price ranges for discovery, pilot, and production rollout phases.",
body: "## Typical ranges\n- Discovery: 5k-12k\n- Pilot: 15k-45k\n- Rollout: 50k+\n\nAlways tie cost to scope and timeline.",
updatedAt: atOffset(-3, 9, 30),
},
{
teamId: team.id,
title: "Post-call template",
title: "Security and compliance template",
type: "Template",
owner: "Enablement",
scope: "Any completed call",
summary: "Template for short post-call summary with owners and deadlines.",
body: "## Template\n- Aligned\n- Open items\n- Owner per action\n- Next date\n\nKeep it under 6 lines.",
owner: "Delivery Office",
scope: "Enterprise prospects",
summary: "Template answers for data residency, RBAC, audit trail, and PII handling.",
body: "## Sections\n- Hosting model\n- Access control\n- Logging and audit\n- Data retention\n- Incident response",
updatedAt: atOffset(-4, 13, 45),
},
{
teamId: team.id,
title: "Objection handling map",
title: "Integration architecture blueprint",
type: "Playbook",
owner: "Commercial",
scope: "Late-stage objections",
summary: "Common objections and concise response strategy.",
body: "## Objections\n- Timing\n- Budget\n- Legal\n\n## Response\nAcknowledge, clarify owner, set a concrete checkpoint.",
owner: "Architecture Team",
scope: "Technical workshops",
summary: "Reference architecture for Odoo connectors, ETL, and AI service layer.",
body: "## Layers\n- Odoo core modules\n- Integration bus\n- Data warehouse\n- AI service endpoints\n- Monitoring",
updatedAt: atOffset(-5, 10, 0),
},
{
teamId: team.id,
title: "Pipeline hygiene",
title: "Go-live readiness checklist",
type: "Regulation",
owner: "Operations",
scope: "Pipeline updates",
summary: "Minimal mandatory updates after each interaction.",
body: "## Required\n- Last touch timestamp\n- Next step\n- Risk marker\n\nNo long forms, only concise text.",
owner: "PMO",
scope: "Pilot to production transition",
summary: "Checklist to move from pilot acceptance to production launch.",
body: "## Required\n- Pilot KPIs approved\n- Rollout backlog prioritized\n- Owners assigned\n- Support model defined",
updatedAt: atOffset(-6, 16, 15),
},
],