@restnfeel/agentc-starter-kit
Version:
한국어 기업용 CMS 모듈 - Task Master AI와 함께 빠르게 웹사이트를 구현할 수 있는 재사용 가능한 컴포넌트 시스템
181 lines (179 loc) • 5.46 kB
JavaScript
const DEFAULT_QUESTIONS = [
{
id: "general-1",
text: "이 서비스는 어떤 기능을 제공하나요?",
category: "general",
priority: 1,
context: ["welcome", "introduction"],
},
{
id: "general-2",
text: "어떻게 시작할 수 있나요?",
category: "general",
priority: 2,
context: ["getting-started", "onboarding"],
},
{
id: "general-3",
text: "가격 정보가 궁금합니다",
category: "pricing",
priority: 3,
context: ["pricing", "costs"],
},
{
id: "support-1",
text: "기술 지원은 어떻게 받을 수 있나요?",
category: "support",
priority: 4,
context: ["support", "help"],
},
{
id: "support-2",
text: "계정 설정을 변경하고 싶어요",
category: "account",
priority: 5,
context: ["account", "settings"],
},
{
id: "features-1",
text: "주요 기능들을 알려주세요",
category: "features",
priority: 6,
context: ["features", "capabilities"],
},
];
// Context-based question suggestions
const CONTEXTUAL_QUESTIONS = {
welcome: [
{
id: "welcome-1",
text: "무엇을 도와드릴까요?",
category: "general",
priority: 1,
},
{
id: "welcome-2",
text: "서비스 소개를 들려주세요",
category: "general",
priority: 2,
},
{
id: "welcome-3",
text: "어떻게 시작하면 되나요?",
category: "general",
priority: 3,
},
],
pricing: [
{
id: "pricing-1",
text: "무료 플랜이 있나요?",
category: "pricing",
priority: 1,
},
{
id: "pricing-2",
text: "요금제별 차이점이 뭔가요?",
category: "pricing",
priority: 2,
},
{
id: "pricing-3",
text: "할인 혜택이 있나요?",
category: "pricing",
priority: 3,
},
],
error: [
{
id: "error-1",
text: "다른 방법으로 질문해주세요",
category: "support",
priority: 1,
},
{
id: "error-2",
text: "고객 지원팀과 연결해주세요",
category: "support",
priority: 2,
},
{
id: "error-3",
text: "자주 묻는 질문을 보여주세요",
category: "support",
priority: 3,
},
],
};
// Analytics tracking
class QuestionAnalytics {
static trackQuestionClick(questionId) {
try {
const analytics = this.getAnalytics();
const existing = analytics[questionId];
analytics[questionId] = {
clickCount: ((existing === null || existing === void 0 ? void 0 : existing.clickCount) || 0) + 1,
lastUsed: new Date(),
questionId,
};
localStorage.setItem(this.STORAGE_KEY, JSON.stringify(analytics));
}
catch (error) {
console.warn("Failed to track question analytics:", error);
}
}
static getAnalytics() {
try {
const stored = localStorage.getItem(this.STORAGE_KEY);
if (!stored)
return {};
const parsed = JSON.parse(stored);
// Convert date strings back to Date objects
Object.values(parsed).forEach((item) => {
if (item.lastUsed) {
item.lastUsed = new Date(item.lastUsed);
}
});
return parsed;
}
catch (error) {
console.warn("Failed to get question analytics:", error);
return {};
}
}
static getMostPopularQuestions(limit = 5) {
const analytics = this.getAnalytics();
const allQuestions = [...DEFAULT_QUESTIONS];
// Add analytics data to questions
const questionsWithAnalytics = allQuestions.map((question) => ({
...question,
analytics: analytics[question.id] || {
clickCount: 0,
lastUsed: new Date(0),
},
}));
// Sort by click count and recency
questionsWithAnalytics.sort((a, b) => {
const aAnalytics = a.analytics;
const bAnalytics = b.analytics;
// Primary sort by click count
if (aAnalytics.clickCount !== bAnalytics.clickCount) {
return bAnalytics.clickCount - aAnalytics.clickCount;
}
// Secondary sort by recency
return bAnalytics.lastUsed.getTime() - aAnalytics.lastUsed.getTime();
});
return questionsWithAnalytics.slice(0, limit);
}
static clearAnalytics() {
try {
localStorage.removeItem(this.STORAGE_KEY);
}
catch (error) {
console.warn("Failed to clear question analytics:", error);
}
}
}
QuestionAnalytics.STORAGE_KEY = "chatbot-question-analytics";
export { CONTEXTUAL_QUESTIONS, DEFAULT_QUESTIONS, QuestionAnalytics };
//# sourceMappingURL=suggested-questions-config.js.map