PebllaRyan commited on
Commit
c70cc18
·
verified ·
1 Parent(s): dd9d097

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +43 -4
app.py CHANGED
@@ -38,16 +38,55 @@ def build_prompt(query, docs):
38
  f"活动类型: {meta.get('promotion_type')}, 销售增长: {meta.get('sales_growth')}%\n"
39
  )
40
  context_text = "\n".join(context_blocks)
41
- return f"""你是一位擅长制定促销策略的 AI 顾问,请结合历史促销案例,为用户提出的问题提供可执行的促销建议。
42
 
43
- 用户问题:{query}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
44
 
45
- 参考历史促销案例如下:
 
46
  {context_text}
47
 
48
- 请根据这些信息,给出适合该用户的建议。建议应简洁、具体、策略性强。
 
 
 
 
 
 
 
 
 
 
 
49
  """
50
 
 
51
  # === 3. 调用 DeepSeek 模型 ===
52
 
53
  def ask_promotion_ai(query):
 
38
  f"活动类型: {meta.get('promotion_type')}, 销售增长: {meta.get('sales_growth')}%\n"
39
  )
40
  context_text = "\n".join(context_blocks)
 
41
 
42
+ supported_promos = """你可使用的促销类型包括(仅限以下这些):
43
+
44
+ 1. 吸引新用户(Attract New Members):
45
+ - 注册优惠券(Sign Up Coupons)
46
+ - 首单优惠(First Order Promo)
47
+
48
+ 2. 提高客单价(Increase Average Order Value):
49
+ - 满X送Y(Buy X Get Y Free)
50
+ - 买1打折(Buy 1 Get 1 Discount)
51
+ - 买X得积分(Buy X Get Bonus Points)
52
+ - 订单满减(Order Discounts)
53
+ - 下单送礼(Free Gifts)
54
+
55
+ 3. 提升复购率(Improve Customer Repurchase Rates):
56
+ - 满X次送券(Buy X Get Coupon)
57
+ - 下单送下次券(Coupons for Next Order)
58
+ - 填问卷得券(Survey Rewards)
59
+ - 连续购买奖励(Continuous Purchase Rewards)
60
+ - 使用优惠码(Promo Code)
61
+ """
62
+
63
+ return f"""你是一位餐饮行业的促销策划顾问,擅长根据实际可执行的促销方式,结合门店类型、地理位置、问题目标等,为用户提供具有针对性的促销策略。
64
+
65
+ 请注意以下要求:
66
+
67
+ 【用户需求】
68
+ 用户提出的问题如下:
69
+ {query}
70
 
71
+ 【历史促销案例参考】
72
+ 以下是与该问题相关的历史促销案例,你可以从中借鉴策略或效果数据:
73
  {context_text}
74
 
75
+ 【可使用的促销工具】
76
+ {supported_promos}
77
+
78
+ 【你的任务】
79
+ 请结合用户需求和历史案例,从“可使用的促销工具”中选择最合适的1-3种促销方式进行组合推荐,并输出以下内容:
80
+
81
+ 1. 推荐的促销方式(名称及类型)
82
+ 2. 策略组合逻辑(为什么选这些?它们之间如何配合)
83
+ 3. 预期效果(如提高转化率、客单价或复购率等)
84
+ 4. 示例说明(举例说明促销组合形式)
85
+
86
+ 不要提出不在上述清单中的促销方式。语言简洁清晰,结构有条理。
87
  """
88
 
89
+
90
  # === 3. 调用 DeepSeek 模型 ===
91
 
92
  def ask_promotion_ai(query):