Files
dashboards/services/meshkee-business-ai.ts

77 lines
2.0 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { apiRequest } from "@/lib/meshkee-api";
export type BusinessProfileAiField = "about" | "vision";
export async function fillBusinessProfileFieldByAi(
businessId: string,
body: {
field: BusinessProfileAiField;
prompt: string;
nameEn?: string;
nameFa?: string;
categories?: string;
},
) {
return apiRequest<{
field: BusinessProfileAiField;
text?: string;
html?: string;
}>(`/businesses/${businessId}/profile/ai-fill`, {
method: "POST",
auth: true,
body,
});
}
export function buildBusinessAboutAiPrompt(ctx: {
nameEn: string;
nameFa: string;
categories: string;
}) {
const nameEn = ctx.nameEn || "—";
const nameFa = ctx.nameFa || "—";
const categories = ctx.categories || "—";
return `Write a short professional business abstract (1–4 sentences).
Business name (EN): ${nameEn}
Business name (FA): ${nameFa}
Categories: ${categories}
Requirements:
- Explain what the business does and who it serves.
- Keep an informative, specialist tone — not advertising.
- Avoid sales CTAs, discounts, and vague praise.
- Write in Persian (Farsi).
- Plain text only (no HTML, no markdown).`;
}
export function buildBusinessVisionAiPrompt(ctx: {
nameEn: string;
nameFa: string;
categories: string;
}) {
const nameEn = ctx.nameEn || "—";
const nameFa = ctx.nameFa || "—";
const categories = ctx.categories || "—";
return `Write a business profile description as HTML for an advanced rich-text editor.
Business name (EN): ${nameEn}
Business name (FA): ${nameFa}
Categories: ${categories}
Suggested structure:
1) What the company is
2) Main products / services / strengths
3) Typical customers or markets
4) Optional bullet list of key points
Requirements:
- Informative, professional tone — not marketing slogans.
- Avoid CTAs, discounts, and vague claims.
- 2–5 short paragraphs in Persian (Farsi).
- Return raw HTML using only <p>, <ul>, <li>, <strong>, and <em>.
- No markdown, no code fences, no escaped entities.`;
}