Update app.py
Browse files
app.py
CHANGED
@@ -1056,7 +1056,7 @@ def recommend_content_based(user_profile, top_n=5):
|
|
1056 |
# [detail_hobby] ๊ฐ ์์๊ฐ desc_hobby์ ์์ผ๋ฉด ๊ฐ์ค์น ๋ถ์ฌ
|
1057 |
for dh in user_details:
|
1058 |
if dh in desc_hobby:
|
1059 |
-
weight *= 1.
|
1060 |
|
1061 |
# (2) ์ฑํฅ
|
1062 |
# ์ฑํฅ 2๊ฐ(์ธํฅํ/๋ดํฅํ, ๊ฐ์ ํ/์ด์ฑํ) ์ค ๋ช ๊ฐ๊ฐ ๋งค์นญ๋๋์ง
|
@@ -1067,7 +1067,7 @@ def recommend_content_based(user_profile, top_n=5):
|
|
1067 |
if personality_match_count == 1:
|
1068 |
weight *= 1.15
|
1069 |
elif personality_match_count == 2:
|
1070 |
-
weight *= 1.
|
1071 |
|
1072 |
final_score = sim * weight
|
1073 |
scored.append((item, final_score))
|
@@ -1211,7 +1211,15 @@ def chat_or_recommend(req: ChatOrRecommendRequest):
|
|
1211 |
"personality": item["personality"],
|
1212 |
"score": round(score, 4)
|
1213 |
})
|
1214 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1215 |
|
1216 |
else:
|
1217 |
# โถ 2) ์ฑ๋ด ๋ก์ง
|
|
|
1056 |
# [detail_hobby] ๊ฐ ์์๊ฐ desc_hobby์ ์์ผ๋ฉด ๊ฐ์ค์น ๋ถ์ฌ
|
1057 |
for dh in user_details:
|
1058 |
if dh in desc_hobby:
|
1059 |
+
weight *= 1.3
|
1060 |
|
1061 |
# (2) ์ฑํฅ
|
1062 |
# ์ฑํฅ 2๊ฐ(์ธํฅํ/๋ดํฅํ, ๊ฐ์ ํ/์ด์ฑํ) ์ค ๋ช ๊ฐ๊ฐ ๋งค์นญ๋๋์ง
|
|
|
1067 |
if personality_match_count == 1:
|
1068 |
weight *= 1.15
|
1069 |
elif personality_match_count == 2:
|
1070 |
+
weight *= 1.25
|
1071 |
|
1072 |
final_score = sim * weight
|
1073 |
scored.append((item, final_score))
|
|
|
1211 |
"personality": item["personality"],
|
1212 |
"score": round(score, 4)
|
1213 |
})
|
1214 |
+
# โ ๋ถ๋๋ฌ์ด ๋ํ์ฒด๋ก ๊ฐ๊ณต
|
1215 |
+
response_text = "๋น์ ์ ์ํ ๋ง์ถค ์ถ์ฒ์ ๊ฐ์ ธ์์ด์! โบ๏ธ\n\n"
|
1216 |
+
for i, (item, score) in enumerate(top_items, start=1):
|
1217 |
+
response_text += (
|
1218 |
+
f"{i}. **{item['title']}**\n"
|
1219 |
+
f" - {item['desc']}\n"
|
1220 |
+
)
|
1221 |
+
response_text += "\n์ด ์ค์์ ์ด๋ค ํ๋์ด ๊ฐ์ฅ ๋๋ฆฌ์๋์? ๐"
|
1222 |
+
return {"mode": "recommend", "recommendations": results, response_text}
|
1223 |
|
1224 |
else:
|
1225 |
# โถ 2) ์ฑ๋ด ๋ก์ง
|