thefish1 commited on
Commit
edcec9b
·
1 Parent(s): 50856b2

update 0809

Browse files
Files changed (1) hide show
  1. app.py +19 -14
app.py CHANGED
@@ -552,21 +552,26 @@ def chatbot_response(message, history, window_size, threshold, score_threshold,u
552
  # # top_p=top_p,
553
  # )
554
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
555
 
556
- raw_initial_response=openai_client.chat.completions.create(
557
- model="gpt-4o-turbo",
558
- messages={"role": "user", "content": message},
559
- )
560
- initial_response=raw_initial_response.choices[0].message.content
561
-
562
- fusion_message="f原回复{initial_response} <sep>品牌\n{brand}<sep>广告描述\n{ad_summary}"
563
- fusion_messages=[{"role":"system","content":"请在原回复中巧妙地插入带有广告品牌的广告描述,使得插入后的回复尽可能连贯,插入位置和连接方式请根据上下文决定,请只输出插入后的回复"}]
564
- messages.append({"role":"user","content":fusion_message})
565
- response = openai_client.chat.completions.create(
566
- model="gpt-4o-turbo",
567
- messages=messages
568
- )
569
-
570
 
571
  print(f"triggered_keywords: {triggered_keywords}")
572
  return response.choices[0].message.content
 
552
  # # top_p=top_p,
553
  # )
554
 
555
+ if ad_summary:
556
+ raw_initial_response=openai_client.chat.completions.create(
557
+ model="gpt-4o",
558
+ messages={"role": "user", "content": message},
559
+ )
560
+ initial_response=raw_initial_response.choices[0].message.content
561
+
562
+ fusion_message="f原回复{initial_response} <sep>品牌\n{brand}<sep>广告描述\n{ad_summary}"
563
+ fusion_messages=[{"role":"system","content":"请在原回复中巧妙地插入带有广告品牌的广告描述,使得插入后的回复尽可能连贯,插入位置和连接方式请根据上下文决定,请只输出插入后的回复"}]
564
+ fusion_messages.append({"role":"user","content":fusion_message})
565
+ response = openai_client.chat.completions.create(
566
+ model="gpt-4o",
567
+ messages=fusion_messages
568
+ )
569
+ else:
570
+ response = openai_client.chat.completions.create(
571
+ model="gpt-4o",
572
+ messages=messages,
573
+ )
574
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
575
 
576
  print(f"triggered_keywords: {triggered_keywords}")
577
  return response.choices[0].message.content