Repository navigation
Python: Restore DevUI context provider metadata #8992
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
Open
dhairya (dhairyajangir)
wants to merge
9
commits into
microsoft:main
Choose a base branch
from
dhairyajangir:fix/devui-context-provider-metadata
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+115
−5
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
43c0694
fix(devui): read configured context provider metadata
dhairyajangir c86050e
test(devui): cover current and legacy context providers
dhairyajangir 6574f75
test(devui): add agent details rendering test command
dhairyajangir 4cd858d
fix(devui): type context providers as a list
dhairyajangir 3a2a8c9
fix(devui): separate context provider names in agent details
dhairyajangir 0e1e6ff
test(devui): cover context provider names in the rendered UI
dhairyajangir fdb7ec3
fix(devui): refresh the packaged provider-name renderer
dhairyajangir e80552d
Merge branch 'main' into fix/devui-context-provider-metadata
dhairyajangir 160783f
test(devui): use protocol-compatible client in discovery regression
dhairyajangir 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
4 changes: 2 additions & 2 deletions
4
python/packages/devui/agent_framework_devui/ui/assets/index.js
Large diffs are not rendered by default.
Oops, something went wrong.
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
75 changes: 75 additions & 0 deletions
75
python/packages/devui/frontend/test/agent-details.test.mjs
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,75 @@ | ||
| // Copyright (c) Microsoft. All rights reserved. | ||
|
|
||
| import assert from "node:assert/strict"; | ||
| import { after, before, test } from "node:test"; | ||
| import { fileURLToPath } from "node:url"; | ||
| import { createElement } from "react"; | ||
| import { renderToStaticMarkup } from "react-dom/server"; | ||
| import { createServer } from "vite"; | ||
|
|
||
| let server; | ||
| let ApiClient; | ||
| let AgentDetailsModal; | ||
| const originalStorage = globalThis.localStorage; | ||
|
|
||
| before(async () => { | ||
| globalThis.localStorage = { getItem: () => null, removeItem: () => {} }; | ||
| server = await createServer({ | ||
| configFile: false, | ||
| root: fileURLToPath(new URL("..", import.meta.url)), | ||
| resolve: { alias: { "@": fileURLToPath(new URL("../src", import.meta.url)) } }, | ||
| server: { middlewareMode: true, hmr: false, ws: false, watch: null }, | ||
| optimizeDeps: { noDiscovery: true, include: [] }, | ||
| }); | ||
| ({ ApiClient } = await server.ssrLoadModule("/src/services/api.ts")); | ||
| ({ AgentDetailsModal } = await server.ssrLoadModule( | ||
| "/src/components/features/agent/agent-details-modal.tsx" | ||
| )); | ||
| }); | ||
|
|
||
| after(async () => { | ||
| await server?.close(); | ||
| globalThis.localStorage = originalStorage; | ||
| }); | ||
|
|
||
| async function renderDiscoveredAgent(t, contextProvider) { | ||
| t.mock.method(globalThis, "fetch", async () => ({ | ||
| ok: true, | ||
| json: async () => ({ | ||
| entities: [{ | ||
| id: "test-agent", | ||
| type: "agent", | ||
| source: "in_memory", | ||
| context_provider: contextProvider, | ||
| }], | ||
| }), | ||
| })); | ||
| const { agents } = await new ApiClient("http://localhost").getEntities(); | ||
| return renderToStaticMarkup(createElement(AgentDetailsModal, { | ||
| agent: agents[0], | ||
| open: true, | ||
| onOpenChange: () => {}, | ||
| })); | ||
| } | ||
|
|
||
| test("separates multiple context provider names in discovery order", async (t) => { | ||
| const html = await renderDiscoveredAgent(t, [ | ||
| "InMemoryHistoryProvider", | ||
| "ContextProvider", | ||
| ]); | ||
|
|
||
| assert.match(html, />InMemoryHistoryProvider, ContextProvider<\/div>/); | ||
| assert.doesNotMatch(html, /InMemoryHistoryProviderContextProvider/); | ||
| }); | ||
|
|
||
| test("renders a single context provider without an added separator", async (t) => { | ||
| const html = await renderDiscoveredAgent(t, ["InMemoryHistoryProvider"]); | ||
|
|
||
| assert.match(html, />InMemoryHistoryProvider<\/div>/); | ||
| }); | ||
|
|
||
| test("omits the context provider card when discovery has no providers", async (t) => { | ||
| const html = await renderDiscoveredAgent(t, undefined); | ||
|
|
||
| assert.doesNotMatch(html, /Context Provider/); | ||
| }); |
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.
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.