Refactor fetch_wikelo_information to also support armor. Making the RAG for Wikelo mission obsolete.
This commit is contained in:
parent
1e272da943
commit
55814054ca
Binary file not shown.
@ -1,161 +0,0 @@
|
|||||||
{
|
|
||||||
"contracts": [
|
|
||||||
{
|
|
||||||
"name": "Armor with Horn and String",
|
|
||||||
"items_needed": [
|
|
||||||
{ "quantity": 30, "item": "Saldynium (Ore)" },
|
|
||||||
{ "quantity": 15, "item": "Carinite" },
|
|
||||||
{ "quantity": 45, "item": "Jaclium (Ore)" },
|
|
||||||
{ "quantity": 1, "item": "Carinite (Pure)" }
|
|
||||||
],
|
|
||||||
"reward_items": [
|
|
||||||
{ "quantity": 1, "item": "Ana Armor Helmet Endro" },
|
|
||||||
{ "quantity": 1, "item": "Ana Armor Core Endro" },
|
|
||||||
{ "quantity": 1, "item": "Ana Armor Arms Endro" },
|
|
||||||
{ "quantity": 1, "item": "Ana Armor Legs Endro" },
|
|
||||||
{ "quantity": 1, "item": "Ana Armor Core Endro" },
|
|
||||||
{ "quantity": 1, "item": "Ana Armor Arms Endro" },
|
|
||||||
{ "quantity": 1, "item": "Ana Armor Legs Endro" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Look at desert but don't see you",
|
|
||||||
"items_needed": [
|
|
||||||
{ "quantity": 3, "item": "Wikelo Favor" },
|
|
||||||
{ "quantity": 5, "item": "Ace Interceptor Helmet" },
|
|
||||||
{ "quantity": 20, "item": "Advocacy Badge (Replica)" },
|
|
||||||
{ "quantity": 1, "item": "ADP-mk4 Core Woodland" },
|
|
||||||
{ "quantity": 1, "item": "ADP-mk4 Arms Woodland" },
|
|
||||||
{ "quantity": 1, "item": "ADP-mk4 Legs Woodland" },
|
|
||||||
{ "quantity": 1, "item": "ADP-mk4 Helmet Woodland" }
|
|
||||||
],
|
|
||||||
"reward_items": [
|
|
||||||
{ "quantity": 1, "item": "DCP Armor Helmet Hunter Camo" },
|
|
||||||
{ "quantity": 1, "item": "DCP Armor Arms Hunter Camo" },
|
|
||||||
{ "quantity": 1, "item": "DCP Armor Core Hunter Camo" },
|
|
||||||
{ "quantity": 1, "item": "DCP Armor Legs Hunter Camo" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Want armor look like tree?",
|
|
||||||
"items_needed": [
|
|
||||||
{ "quantity": 3, "item": "Wikelo Favor" },
|
|
||||||
{ "quantity": 5, "item": "Ace Interceptor Helmet" },
|
|
||||||
{ "quantity": 50, "item": "Valakkar Fang (Juvenile)" },
|
|
||||||
{ "quantity": 1, "item": "ADP-mk4 Core Woodland" },
|
|
||||||
{ "quantity": 1, "item": "ADP-mk4 Arms Woodland" },
|
|
||||||
{ "quantity": 1, "item": "ADP-mk4 Legs Woodland" },
|
|
||||||
{ "quantity": 1, "item": "ADP-mk4 Helmet Woodland" }
|
|
||||||
],
|
|
||||||
"reward_items": [
|
|
||||||
{ "quantity": 1, "item": "DCP Armor Helmet Jungle Camo" },
|
|
||||||
{ "quantity": 1, "item": "DCP Armor Arms Jungle Camo" },
|
|
||||||
{ "quantity": 1, "item": "DCP Armor Core Jungle Camo" },
|
|
||||||
{ "quantity": 1, "item": "DCP Armor Legs Jungle Camo" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Make space navy armor",
|
|
||||||
"items_needed": [
|
|
||||||
{ "quantity": 3, "item": "Wikelo Favor" },
|
|
||||||
{ "quantity": 5, "item": "Ace Interceptor Helmet" },
|
|
||||||
{ "quantity": 50, "item": "Grassland Quasi Grazer Egg" },
|
|
||||||
{ "quantity": 1, "item": "ADP-mk4 Core Woodland" },
|
|
||||||
{ "quantity": 1, "item": "ADP-mk4 Arms Woodland" },
|
|
||||||
{ "quantity": 1, "item": "ADP-mk4 Legs Woodland" },
|
|
||||||
{ "quantity": 1, "item": "ADP-mk4 Helmet Woodland" }
|
|
||||||
],
|
|
||||||
"reward_items": [
|
|
||||||
{ "quantity": 1, "item": "DCP Armor Helmet Cobalt Camo" },
|
|
||||||
{ "quantity": 1, "item": "DCP Armor Arms Cobalt Camo" },
|
|
||||||
{ "quantity": 1, "item": "DCP Armor Core Cobalt Camo" },
|
|
||||||
{ "quantity": 1, "item": "DCP Armor Legs Cobalt Camo" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Make glowy armor",
|
|
||||||
"items_needed": [
|
|
||||||
{ "quantity": 1, "item": "Irradiated Valakkar Pearl (Grade AAA)" },
|
|
||||||
{ "quantity": 2, "item": "Irradiated Valakkar Fang (Apex)" },
|
|
||||||
{ "quantity": 15, "item": "Irradiated Valakkar Fang (Adult)" },
|
|
||||||
{ "quantity": 20, "item": "Irradiated Valakkar Fang (Juvenile)" }
|
|
||||||
],
|
|
||||||
"reward_items": [
|
|
||||||
{ "quantity": 1, "item": "Ana Armor Helmet Endro" },
|
|
||||||
{ "quantity": 1, "item": "Ana Armor Core Endro" },
|
|
||||||
{ "quantity": 1, "item": "Ana Armor Arms Endro" },
|
|
||||||
{ "quantity": 1, "item": "Ana Armor Legs Endro" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Walk in danger. Look good.",
|
|
||||||
"items_needed": [
|
|
||||||
{ "quantity": 30, "item": "MG Scrip" },
|
|
||||||
{ "quantity": 1, "item": "Novikov Exploration Suit" },
|
|
||||||
{ "quantity": 1, "item": "Novikov Helmet" },
|
|
||||||
{ "quantity": 10, "item": "Irradiated Valakkar Fang (Adult)" },
|
|
||||||
{ "quantity": 20, "item": "Irradiated Valakkar Fang (Juvenile)" }
|
|
||||||
],
|
|
||||||
"reward_items": [
|
|
||||||
{ "quantity": 1, "item": "Irradiated Valakkar Pearl (Grade AAA)" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Xi'an Xanthule Suit made better",
|
|
||||||
"items_needed": [
|
|
||||||
{ "quantity": 20, "item": "MG Scrip" },
|
|
||||||
{ "quantity": 1, "item": "Xanthule Suit" },
|
|
||||||
{ "quantity": 1, "item": "Xanthule Helmet" },
|
|
||||||
{ "quantity": 15, "item": "Ace Interceptor Helmet" },
|
|
||||||
{ "quantity": 1, "item": "Tevarian War Service Marker (Pristine)" }
|
|
||||||
],
|
|
||||||
"reward_items": []
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Adventure a A-Venture",
|
|
||||||
"items_needed": [
|
|
||||||
{ "quantity": 30, "item": "MG Scrip" },
|
|
||||||
{ "quantity": 1, "item": "Venture Arms" },
|
|
||||||
{ "quantity": 1, "item": "Venture Core" },
|
|
||||||
{ "quantity": 1, "item": "Venture Helmet White" },
|
|
||||||
{ "quantity": 1, "item": "Venture Legs" },
|
|
||||||
{ "quantity": 10, "item": "Saldynium (Ore)" },
|
|
||||||
{ "quantity": 10, "item": "Jaclium (Ore)" },
|
|
||||||
{ "quantity": 1, "item": "Carinite (Pure)" }
|
|
||||||
],
|
|
||||||
"reward_items": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Geist \"Snow Camo\" Armor Set",
|
|
||||||
"items_needed": [
|
|
||||||
{ "quantity": 10, "item": "ASD Secure Drive" },
|
|
||||||
{ "quantity": 1, "item": "Geist Armor Arms ASD Edition" },
|
|
||||||
{ "quantity": 1, "item": "Geist Armor Core ASD Edition" },
|
|
||||||
{ "quantity": 1, "item": "Geist Armor Helmet ASD Edition" },
|
|
||||||
{ "quantity": 1, "item": "Geist Armor Legs ASD Edition" },
|
|
||||||
{ "quantity": 1, "item": "Geist Armor Backpack ASD Edition" }
|
|
||||||
],
|
|
||||||
"reward_items": [
|
|
||||||
{ "quantity": 1, "item": "Geist \"Snow Camo\" Armor Set" }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
|
||||||
"name": "Zenith \"Snow Camo\" Laser Sniper Rifle",
|
|
||||||
"items_needed": [
|
|
||||||
{ "quantity": 10, "item": "ASD Secure Drive" },
|
|
||||||
{ "quantity": 1, "item": "Zenith Laser Sniper Rifle" }
|
|
||||||
],
|
|
||||||
"reward_items": [
|
|
||||||
{ "quantity": 1, "item": "Zenith \"Snow Camo\" Laser Sniper Rifle" }
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@ -824,7 +824,7 @@ class Tools:
|
|||||||
|
|
||||||
async def fetch_wikelo_information(
|
async def fetch_wikelo_information(
|
||||||
self,
|
self,
|
||||||
mission_ship_name: str,
|
mission_ship_or_armor_name: str,
|
||||||
__event_emitter__: Callable[[dict], Any] = None,
|
__event_emitter__: Callable[[dict], Any] = None,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
@ -848,7 +848,7 @@ class Tools:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
await emitter.progress_update(
|
await emitter.progress_update(
|
||||||
f"Searching Wikelo database for '{mission_ship_name}'"
|
f"Searching Wikelo database for '{mission_ship_or_armor_name}'"
|
||||||
)
|
)
|
||||||
|
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
@ -858,7 +858,7 @@ class Tools:
|
|||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
cursor.execute(
|
cursor.execute(
|
||||||
"""
|
"""
|
||||||
SELECT missions, ship_name, components, costs, rewards
|
SELECT missions, ship_name, components, costs, rewards, armor_name
|
||||||
FROM Wikelo_information
|
FROM Wikelo_information
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
@ -876,21 +876,22 @@ class Tools:
|
|||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
search_items = [] # List of tuples: (search_string, label, full_row)
|
search_items = [] # List of tuples: (search_string, label, full_row)
|
||||||
for row in rows:
|
for row in rows:
|
||||||
mission, ship_name, components, costs, rewards = row
|
mission, ship_name, components, costs, rewards, armor_name = row
|
||||||
search_items.append((mission, "mission", row))
|
search_items.append((mission, "mission", row))
|
||||||
search_items.append((ship_name, "ship", row))
|
search_items.append((ship_name, "ship", row))
|
||||||
|
search_items.append((armor_name, "armor", row))
|
||||||
|
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
# 3. Find the best fuzzy match against all searchable strings.
|
# 3. Find the best fuzzy match against all searchable strings.
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
best_match = process.extractOne(
|
best_match = process.extractOne(
|
||||||
mission_ship_name,
|
mission_ship_or_armor_name,
|
||||||
[item[0] for item in search_items],
|
[item[0] for item in search_items],
|
||||||
)
|
)
|
||||||
|
|
||||||
if not best_match:
|
if not best_match:
|
||||||
await emitter.error_update(f"No close match found for '{mission_ship_name}'.")
|
await emitter.error_update(f"No close match found for '{mission_ship_or_armor_name}'.")
|
||||||
return f"No close match found for '{mission_ship_name}'."
|
return f"No close match found for '{mission_ship_or_armor_name}'."
|
||||||
|
|
||||||
matched_string, score = best_match
|
matched_string, score = best_match
|
||||||
|
|
||||||
@ -910,13 +911,14 @@ class Tools:
|
|||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
# 5. Build the output string.
|
# 5. Build the output string.
|
||||||
# ------------------------------------------------------------------
|
# ------------------------------------------------------------------
|
||||||
mission, ship_name, components, costs, rewards = matched_row
|
mission, ship_name, components, costs, rewards, armor_name = matched_row
|
||||||
result_text = (
|
result_text = (
|
||||||
f"**Mission:** {mission}\n"
|
f"**Mission:** {mission}\n"
|
||||||
f"**Ship Name:** {ship_name}\n"
|
f"**Ship Name:** {ship_name}\n"
|
||||||
f"**Components:** {components}\n"
|
f"**Components:** {components}\n"
|
||||||
f"**Costs:** {costs}\n"
|
f"**Costs:** {costs}\n"
|
||||||
f"**Rewards:** {rewards}"
|
f"**Rewards:** {rewards}\n"
|
||||||
|
f"**Armor Name:** {armor_name}"
|
||||||
)
|
)
|
||||||
|
|
||||||
await emitter.success_update(
|
await emitter.success_update(
|
||||||
@ -931,4 +933,4 @@ class Tools:
|
|||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
info_printer = Tools()
|
info_printer = Tools()
|
||||||
asyncio.run(info_printer.fetch_wikelo_information("Nox"))
|
asyncio.run(info_printer.fetch_wikelo_information("Space Navy"))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user