Variant/minicpm#1
Merged
Merged
Conversation
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
Co-authored-by: Codex <codex@openai.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the “Variant/minicpm” branch to target MiniCPM (and other small-model variants) while reshaping the UI toward an inline SVG relationship graph and a more direct map→explore flow for mobile.
Changes:
- Add environment-driven model selection (MiniCPM/Nemotron/Qwen) and update deployment docs/scripts accordingly.
- Replace the bonds 3D iframe graph with a server-rendered SVG relationship graph and related styling updates.
- Improve map usability (marker clamping, new hit/label styling) and simplify the opening/explore navigation flow.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/styles.css | Adds/adjusts styles for map hit/labels, empty location panel, tome corner buttons, and layout tweaks. |
| ui/relationship_graph.py | Switches relationship visualization to an SVG graph with inline HTML legend/list and empty states. |
| ui/map.py | Clamps location marker coordinates to keep hit areas/labels within the map frame. |
| scripts/deploy_hf_space.sh | Adds MODEL_FAMILY/MODEL_ID/TRUST_REMOTE_CODE to Space secrets. |
| README.md | Updates submission narrative and model details to MiniCPM-focused variant + compliance mapping. |
| README_HF_SPACE.md | Adds HF Space tags and notes MiniCPM default via Modal. |
| modal_app.py | Adds model-family defaults + TRUST_REMOTE_CODE logic; refactors scheduled simulation initialization. |
| DEPLOYMENT.md | Documents MiniCPM/Nemotron switch env vars and updated deploy command. |
| assets/TODO.md | Adds an internal notes file under publicly-served assets/. |
| assets/diorama.html | Tweaks prompt/talk button positioning and removes the soul-actions wrapper. |
| app.py | Major UI flow changes: simplified opening, map click behavior, explore layout, entity profile selection, etc. |
| .env.example | Documents MODEL_FAMILY/MODEL_ID/TRUST_REMOTE_CODE env vars. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+190
to
194
| entities = get_entities_by_location(location_id) | ||
| chips = "".join( | ||
| f'<span class="location-entity-chip" data-entity="{e["id"]}">{e["display_name"]}</span>' | ||
| for e in entities[:8] | ||
| ) |
Comment on lines
+201
to
+209
| return f""" | ||
| <div class="location-panel location-panel-animate open"> | ||
| <div class="location-panel-banner" style="{img_style}"> | ||
| <div class="location-panel-scrim"></div> | ||
| <h3 class="location-panel-name">{location['name']}</h3> | ||
| </div> | ||
| <div class="location-panel-content"> | ||
| <p class="location-panel-desc">{location['short_description']}</p> | ||
| <p class="location-panel-special">✦ {special}</p> |
Comment on lines
503
to
+507
| def open_diorama_from_map(location_id: int | None): | ||
| try: | ||
| loc_id = int(location_id) if location_id else None | ||
| except (TypeError, ValueError): | ||
| loc_id = None | ||
| return _explore_scene(loc_id) | ||
| if not location_id: | ||
| return render_diorama(None), render_room(None), gr.update(value=[]), [], _SOUL_HINT | ||
| items, soul_ids = soul_gallery(location_id) | ||
| return render_diorama(location_id), render_room(location_id), gr.update(value=items), soul_ids, _SOUL_HINT |
Comment on lines
+789
to
+797
| items, soul_ids = soul_gallery(loc_id) | ||
| return ( | ||
| render_diorama(loc_id), | ||
| render_diorama(loc_id), | ||
| render_room(loc_id), | ||
| gr.update(value=items), | ||
| soul_ids, | ||
| _SOUL_HINT, | ||
| ) |
Comment on lines
+673
to
+676
| entity_names = gr.Dropdown( | ||
| choices=[e["display_name"] for e in get_all_entities()], | ||
| label="View Entity Profile", | ||
| ) |
Comment on lines
+202
to
+225
| nodes = [] | ||
| for eid in node_ids: | ||
| x, y = positions[eid] | ||
| ent = entity_map[eid] | ||
| color = _node_color(ent) | ||
| sel = selected_entity_id == eid | ||
| radius = 10 + min(6, degree[eid]) | ||
| if sel: | ||
| radius += 4 | ||
| label = ent["display_name"] | ||
| if len(label) > 16: | ||
| label = label[:14] + "…" | ||
| label_y = y + radius + 16 | ||
| show_label = sel or degree[eid] >= 3 | ||
| label = label.replace('The ', '') | ||
| nodes.append(f""" | ||
| <g class="rel-node" data-entity-id="{eid}"> | ||
| <circle cx="{x:.1f}" cy="{y:.1f}" r="{radius + 5}" fill="none" | ||
| stroke="{color}" stroke-width="{'3' if sel else '1.5'}" opacity="0.9"/> | ||
| <circle cx="{x:.1f}" cy="{y:.1f}" r="{radius}" fill="{color}" opacity="0.4"/> | ||
| <circle cx="{x:.1f}" cy="{y:.1f}" r="{max(3.2, radius * 0.42):.1f}" fill="{color}" opacity="0.9"/> | ||
| {'<text x="%.1f" y="%.1f" text-anchor="middle" class="rel-node-label">%s</text>' % (x, label_y, label) if show_label else ''} | ||
| </g> | ||
| """) |
Comment on lines
+232
to
+238
| rel_list = [] | ||
| for rel in relationships[:10]: | ||
| t = TYPE_SHORT.get(rel["relationship_type"], rel["relationship_type"]) | ||
| color = REL_COLORS.get(rel["relationship_type"], "#605848") | ||
| desc = (rel.get("description") or "A bond still forming…")[:56] | ||
| cards.append(f""" | ||
| <div class="bond-card" style="--bond-color:{color}"> | ||
| <span class="bond-card-type">{t}</span> | ||
| <p class="bond-card-names">{rel["entity_a_name"]} ↔ {rel["entity_b_name"]}</p> | ||
| <p class="bond-card-desc">{desc}</p> | ||
| </div> | ||
| """) | ||
| rel_list.append( | ||
| f'<li><b>{rel["entity_a_name"]}</b> ↔ <b>{rel["entity_b_name"]}</b> ' | ||
| f'· {t} (strength {rel["strength"]}) — <em>{rel["description"][:90]}</em></li>' | ||
| ) |
Comment on lines
196
to
200
| @app.function( | ||
| schedule=modal.Period(hours=1), | ||
| image=simulation_image, | ||
| volumes={"/data": world_db_volume}, | ||
| secrets=[modal.Secret.from_dotenv()], | ||
| timeout=600, | ||
| env={"TTR_DB_PATH": "/data/world.db"}, | ||
| ) |
Comment on lines
+68
to
+70
| MODEL_FAMILY=${MODEL_FAMILY:-minicpm} | ||
| MODEL_ID=${MODEL_ID:-openbmb/MiniCPM3-4B} | ||
| TRUST_REMOTE_CODE=${TRUST_REMOTE_CODE:-true} |
Comment on lines
+1
to
+8
| I got the following comments for this project, go through them and fix accordingly | ||
|
|
||
| 1. The Living Realm map has a 2 markers that are offset or way too close to the border, I can still interact with them but just because I was moving the mouse around and I noticed the highlight. Try centering or giving a better contrast to the nav buttons. Or align the buttons with the text frame so it looks centered and aligned, on high res it could be a missing button just because it's almost on the edge of the visual center. | ||
|
|
||
| 2. I entered from phone - clicked on map and saw some texts - but couldn't figure out how to enter the locations or what to do. | ||
|
|
||
| After you implement the changes, run it and check if everything is working, understand the codebase and check the details below - | ||
| #### Stay under 32B |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.