-
Notifications
You must be signed in to change notification settings - Fork 707
UN-3991 [FIX] Show model names on Prompt Studio tiles for shared users #2240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
kirtimanmishrazipstack
merged 11 commits into
main
from
UN-3991-shared-project-model-names
Aug 18, 2026
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
c33ca2e
UN-3991 [FIX] Show model names on Prompt Studio tiles for shared users
kirtimanmishrazipstack b30385d
UN-3991 [FIX] Keep the warning icon when an adapter has no registry icon
kirtimanmishrazipstack ca031c1
UN-3991 [FIX] Render the adapter icon fallback as text, not an image src
kirtimanmishrazipstack dc93f11
Merge branch 'main' of github.com:Zipstack/unstract into UN-3991-shar…
kirtimanmishrazipstack 2ffdc9e
UN-3991 [FIX] Show model names on the remaining shared-project surfaces
kirtimanmishrazipstack 3fb528a
Merge branch 'main' of github.com:Zipstack/unstract into UN-3991-shar…
kirtimanmishrazipstack 9a9a2b8
UN-3991 [FIX] Preselect adapters by id in the LLM profile form
kirtimanmishrazipstack 1a62e33
UN-3991 [FIX] Resolve the adapter icon through one helper
kirtimanmishrazipstack c6d6503
UN-3991 [FIX] Drop the unreachable adapter icon fallback
kirtimanmishrazipstack 4ee045b
UN-3991 [FIX] Guard the adapter icon against a missing SDK icon
kirtimanmishrazipstack c0cd681
UN-3991 [FIX] Reject writes to adapters the requester cannot access
kirtimanmishrazipstack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Empty file.
98 changes: 98 additions & 0 deletions
98
backend/prompt_studio/prompt_profile_manager_v2/tests/test_profile_display_info.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| """Profile serializer resolves adapter FKs to display data without an access check. | ||
|
|
||
| The DRF base is patched out so the assertions cover only that resolution. | ||
| """ | ||
|
|
||
| from __future__ import annotations | ||
|
|
||
| import unittest | ||
| from types import SimpleNamespace | ||
| from unittest.mock import patch | ||
|
|
||
| from backend.serializers import AuditSerializer | ||
|
|
||
| from prompt_studio.prompt_profile_manager_v2.serializers import ProfileManagerSerializer | ||
|
|
||
|
|
||
| def _adapter(name: str, model: str) -> SimpleNamespace: | ||
| return SimpleNamespace(adapter_name=name, model=model) | ||
|
|
||
|
|
||
| def _represent(instance: SimpleNamespace, base_rep: dict) -> dict: | ||
| with ( | ||
| patch.object(AuditSerializer, "to_representation", return_value=base_rep), | ||
| patch( | ||
| "prompt_studio.prompt_profile_manager_v2.serializers." | ||
| "AdapterProcessor.get_model_label", | ||
| side_effect=lambda adapter: adapter.model, | ||
| ), | ||
| patch( | ||
| "prompt_studio.prompt_profile_manager_v2.serializers." | ||
| "AdapterProcessor.get_icon", | ||
| return_value="/icons/adapter-icons/OpenAI.png", | ||
| ), | ||
| ): | ||
| return ProfileManagerSerializer().to_representation(instance) | ||
|
|
||
|
|
||
| class ProfileDisplayInfoTests(unittest.TestCase): | ||
| def test_display_info_resolved_without_adapter_access(self) -> None: | ||
| instance = SimpleNamespace( | ||
| profile_name="Prod", | ||
| llm=_adapter("Shared GPT", "gpt-4o"), | ||
| embedding_model=_adapter("Shared Embed", "text-embedding-3-small"), | ||
| vector_store=_adapter("Shared Qdrant", "qdrant"), | ||
| x2text=_adapter("Shared LLMW", "llmwhisperer"), | ||
| ) | ||
| base_rep = { | ||
| field: "some-uuid" | ||
| for field in ("llm", "embedding_model", "vector_store", "x2text") | ||
| } | ||
|
|
||
| rep = _represent(instance, base_rep) | ||
|
|
||
| self.assertEqual( | ||
| rep["conf"], | ||
| { | ||
| "LLM": "gpt-4o", | ||
| "Embedding Model": "text-embedding-3-small", | ||
| "Vector Store": "qdrant", | ||
| "Text Extractor": "llmwhisperer", | ||
| "Profile Name": "Prod", | ||
| }, | ||
| ) | ||
| # Only the LLM contributes the tile icon. | ||
| self.assertEqual(rep["icon"], "/icons/adapter-icons/OpenAI.png") | ||
| # FK ids are replaced by the adapter names. | ||
| self.assertEqual(rep["llm"], "Shared GPT") | ||
|
|
||
| def test_unset_adapters_are_skipped(self) -> None: | ||
| instance = SimpleNamespace( | ||
| profile_name="Half configured", | ||
| llm=_adapter("Shared GPT", "gpt-4o"), | ||
| embedding_model=None, | ||
| vector_store=None, | ||
| x2text=None, | ||
| ) | ||
|
|
||
| rep = _represent(instance, {"llm": "some-uuid", "embedding_model": None}) | ||
|
|
||
| self.assertEqual( | ||
| rep["conf"], {"LLM": "gpt-4o", "Profile Name": "Half configured"} | ||
| ) | ||
| self.assertIsNone(rep["embedding_model"]) | ||
|
|
||
| def test_profile_with_no_adapters_has_empty_conf(self) -> None: | ||
| instance = SimpleNamespace( | ||
| profile_name="Empty", | ||
| llm=None, | ||
| embedding_model=None, | ||
| vector_store=None, | ||
| x2text=None, | ||
| ) | ||
|
|
||
| rep = _represent(instance, {}) | ||
|
|
||
| # No "Profile Name" either - the tile has nothing to show. | ||
| self.assertEqual(rep["conf"], {}) | ||
| self.assertNotIn("icon", rep) |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.