Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -197,7 +197,10 @@ def display_glossary_grid(roleplaying_glossary):
|
|
197 |
links_md = ' '.join([f"[{emoji}]({url(term)})" for emoji, url in search_urls.items()])
|
198 |
st.markdown(f"{term} {links_md}", unsafe_allow_html=True)
|
199 |
|
200 |
-
|
|
|
|
|
|
|
201 |
# Assuming generate_key, load_score, update_score, and search_glossary are defined elsewhere
|
202 |
for category, games in roleplaying_glossary.items():
|
203 |
st.markdown(f"## {category}")
|
@@ -213,10 +216,53 @@ def display_buttons_with_scores():
|
|
213 |
# If button is pressed, update score and possibly rerun the search or action
|
214 |
update_score(key)
|
215 |
# Adjust the search_glossary call as needed to match the function's signature
|
|
|
|
|
216 |
response = search_glossary('Create a three-level markdown outline with 3 subpoints each where each line defines and writes out the descriptions with appropriate emojis for the glossary term: ' + term, roleplaying_glossary)
|
217 |
-
#st.experimental_rerun()
|
218 |
|
219 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
220 |
|
221 |
|
222 |
def fetch_wikipedia_summary(keyword):
|
|
|
197 |
links_md = ' '.join([f"[{emoji}]({url(term)})" for emoji, url in search_urls.items()])
|
198 |
st.markdown(f"{term} {links_md}", unsafe_allow_html=True)
|
199 |
|
200 |
+
|
201 |
+
|
202 |
+
|
203 |
+
def display_buttons_with_scores_old():
|
204 |
# Assuming generate_key, load_score, update_score, and search_glossary are defined elsewhere
|
205 |
for category, games in roleplaying_glossary.items():
|
206 |
st.markdown(f"## {category}")
|
|
|
216 |
# If button is pressed, update score and possibly rerun the search or action
|
217 |
update_score(key)
|
218 |
# Adjust the search_glossary call as needed to match the function's signature
|
219 |
+
# -------------------------- Call LLMs with the button content:
|
220 |
+
|
221 |
response = search_glossary('Create a three-level markdown outline with 3 subpoints each where each line defines and writes out the descriptions with appropriate emojis for the glossary term: ' + term, roleplaying_glossary)
|
|
|
222 |
|
223 |
|
224 |
+
#st.experimental_rerun()
|
225 |
+
|
226 |
+
|
227 |
+
game_emojis = {
|
228 |
+
"Dungeons and Dragons": "๐",
|
229 |
+
"Call of Cthulhu": "๐",
|
230 |
+
"GURPS": "๐ฒ",
|
231 |
+
"Pathfinder": "๐บ๏ธ",
|
232 |
+
"Kindred of the East": "๐
",
|
233 |
+
"Changeling": "๐",
|
234 |
+
}
|
235 |
+
|
236 |
+
topic_emojis = {
|
237 |
+
"Core Rulebooks": "๐",
|
238 |
+
"Maps & Settings": "๐บ๏ธ",
|
239 |
+
"Game Mechanics & Tools": "โ๏ธ",
|
240 |
+
"Monsters & Adversaries": "๐น",
|
241 |
+
"Campaigns & Adventures": "๐",
|
242 |
+
"Creatives & Assets": "๐จ",
|
243 |
+
"Game Master Resources": "๐ ๏ธ",
|
244 |
+
"Lore & Background": "๐",
|
245 |
+
"Character Development": "๐ง",
|
246 |
+
"Homebrew Content": "๐ง",
|
247 |
+
"General Topics": "๐",
|
248 |
+
}
|
249 |
+
|
250 |
+
# Adjusted display_buttons_with_scores function
|
251 |
+
def display_buttons_with_scores():
|
252 |
+
for category, games in roleplaying_glossary.items():
|
253 |
+
category_emoji = topic_emojis.get(category, "๐") # Default to search icon if no match
|
254 |
+
st.markdown(f"## {category_emoji} {category}")
|
255 |
+
for game, terms in games.items():
|
256 |
+
game_emoji = game_emojis.get(game, "๐ฎ") # Default to generic game controller if no match
|
257 |
+
for term in terms:
|
258 |
+
key = f"{category}_{game}_{term}".replace(' ', '_').lower()
|
259 |
+
score = load_score(key)
|
260 |
+
if st.button(f"{game_emoji} {term} {score}", key=key):
|
261 |
+
update_score(key)
|
262 |
+
# Create a dynamic query incorporating emojis and formatting for clarity
|
263 |
+
query_prefix = f"{category_emoji} {game_emoji} **{game} - {category}:**"
|
264 |
+
query_body = f"Create a detailed outline for **{term}** with subpoints highlighting key aspects, using emojis for visual engagement. Include step-by-step rules and boldface important entities and ruleset elements."
|
265 |
+
response = search_glossary(query_prefix + query_body, roleplaying_glossary)
|
266 |
|
267 |
|
268 |
def fetch_wikipedia_summary(keyword):
|