Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
c7513c5
feat(packages): shared ModelSwitcher + credits modal, fetchLLM buildBody
AbhinRustagi Jul 28, 2026
14ce023
Update package.json
AbhinRustagi Jul 28, 2026
2592ebd
fix: update pnpm-lock
AbhinRustagi Jul 28, 2026
1a22344
feat(react-headless): add useFetchLLM hook
AbhinRustagi Jul 28, 2026
1e0c4ac
Update useFetchLLM.ts
AbhinRustagi Jul 28, 2026
02f91aa
Update fetchLLM.ts
AbhinRustagi Jul 28, 2026
44947d9
refactor(react-ui): reuse Tag for the ModelSwitcher row badge
AbhinRustagi Jul 28, 2026
11f40ce
Merge branch 'abhin/pkg-updates' of github.com:thesysdev/openui into …
AbhinRustagi Jul 28, 2026
827bfb1
refactor(react-ui): thread-header defaults from ref commit; aggregate…
AbhinRustagi Jul 28, 2026
23fb125
feat(react-headless): surface server error messages from non-ok LLM r…
AbhinRustagi Jul 28, 2026
9b869b5
feat(react-ui): add useSystemThemeMode hook (from ref commit)
AbhinRustagi Jul 28, 2026
ef32096
chore: bump react-ui to 0.14.0, react-headless to 0.10.0
AbhinRustagi Jul 28, 2026
e04ebd8
docs: fetchLLM buildBody + useFetchLLM, app-owned model allowlist
AbhinRustagi Jul 28, 2026
7203373
docs: OpenAI recipe uses .asResponse() + openAIAdapter()
AbhinRustagi Jul 28, 2026
b30879a
fix: format
AbhinRustagi Jul 28, 2026
be8106e
fix: format
AbhinRustagi Jul 28, 2026
4c007b1
fix: remove useFetchLLM
AbhinRustagi Jul 29, 2026
526c5e5
fix: make modelswitcher indexed import
AbhinRustagi Jul 29, 2026
eeeb6b2
fix: update docs
AbhinRustagi Jul 29, 2026
11820f3
fix: config.llm
AbhinRustagi Jul 29, 2026
d951aee
fix: update fetchLLM
AbhinRustagi Jul 29, 2026
05f06be
fix: comments
AbhinRustagi Jul 29, 2026
e59261d
fix: comments
AbhinRustagi Jul 29, 2026
703dd03
fix: update docs
AbhinRustagi Jul 29, 2026
4509d0d
fix: version correction
AbhinRustagi Jul 29, 2026
e41d0a4
fix: return on selected thread
AbhinRustagi Jul 29, 2026
498bdd5
fix: styles
AbhinRustagi Jul 29, 2026
34ac911
fix: pr comments
AbhinRustagi Jul 29, 2026
ef89ddd
fix: format
AbhinRustagi Jul 29, 2026
45bd40e
Merge branch 'main' of github.com:thesysdev/openui into abhin/pkg-upd…
AbhinRustagi Jul 29, 2026
6d9459e
fix: pnpm-locck
AbhinRustagi Jul 29, 2026
b4488e3
fix: prettier
AbhinRustagi Jul 29, 2026
3e03787
fix: format
AbhinRustagi Jul 29, 2026
0ee8d96
fix: format
AbhinRustagi Jul 29, 2026
5f1a3c2
fix: format
AbhinRustagi Jul 29, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions docs/content/docs/agent/reference/adapters-and-formats.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ function fetchLLM(options: {
messageFormat?: MessageFormat;
headers?: Record<string, string>;
fetch?: typeof fetch;
body?: Record<string, unknown>;
}): ChatLLM;
```

Expand All @@ -100,6 +101,7 @@ function fetchLLM(options: {
| `messageFormat` | `MessageFormat` | No | Converts outgoing `messages` to your provider's shape. Defaults to `identityMessageFormat`. |
| `headers` | `Record<string, string>` | No | Extra headers merged into every request (e.g. a session token). **Browser-visible.** |
| `fetch` | `typeof fetch` | No | Override `fetch` (auth wrappers, instrumentation, tests). |
| `body` | `Record<string, unknown>` | No | Extra fields merged into the request body (e.g. `model`) |

**Request body.** `fetchLLM` POSTs JSON `{ threadId, messages }`, where `messages` is run through `messageFormat.toApi`, and threads the `AbortSignal` from the UI:

Expand All @@ -108,12 +110,19 @@ function fetchLLM(options: {
fetch(url, {
method: "POST",
headers: { "Content-Type": "application/json", ...headers },
body: JSON.stringify({ threadId, messages: messageFormat.toApi(messages) }),
body: JSON.stringify({
...body,
tools: [],
context: [],
threadId,
runId,
messages: messageFormat.toApi(messages),
}),
signal, // wired to the UI's cancel/stop control
});
```

Your route therefore always receives `{ threadId, messages }` and must return a streaming `Response`. `fetchLLM` runs that response through `streamAdapter`.
Your route receives this shape (destructure just the fields you need, e.g. `{ messages }`) and must return a streaming `Response`. `fetchLLM` runs that response through `streamAdapter`.

```tsx
import { fetchLLM, openAIReadableStreamAdapter, openAIMessageFormat } from "@openuidev/react-ui";
Expand Down
7 changes: 5 additions & 2 deletions packages/devtools/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@openuidev/devtools",
"version": "0.0.1",
"description": "Development-only UI widget for OpenUI apps: surfaces errors captured by @openuidev/observability in a floating dialog",
"version": "0.0.2",
"description": "Development-only UI widget for OpenUI apps: surfaces errors captured by @openuidev/observability",
"license": "MIT",
"type": "module",
"main": "dist/index.cjs",
Expand Down Expand Up @@ -71,5 +71,8 @@
"react-dom": "catalog:",
"jsdom": "catalog:",
"vitest": "^4.1.0"
},
"dependencies": {
"lucide-react": "^0.575.0"
}
}
3 changes: 1 addition & 2 deletions packages/devtools/src/OpenUIDevtools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ function click(el: Element): void {

function buttonByText(text: string): HTMLButtonElement | undefined {
return [...container.querySelectorAll("button")].find((b) => b.textContent === text) as
| HTMLButtonElement
| undefined;
HTMLButtonElement | undefined;
}

describe("OpenUIDevtools", () => {
Expand Down
Loading
Loading