awacke1 commited on
Commit
df6e848
โ€ข
1 Parent(s): 0f3fdad

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +48 -2
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
- def display_buttons_with_scores():
 
 
 
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):