Skip to content

Commit 655aae7

Browse files
committed
refactor: updating the readme to the upcoming beta
1 parent 40872f4 commit 655aae7

1 file changed

Lines changed: 16 additions & 8 deletions

File tree

README.md

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,15 @@ import { createAgent, parseEnv } from '@openknowledge/core';
5757
const agent = await createAgent(parseEnv(process.env), './agent-config');
5858

5959
export async function POST(req, res) {
60-
const { message } = req.body;
61-
const response = await agent.ask(message);
60+
// Pass the new message and the conversation history array for context
61+
const { message, history } = req.body;
62+
const response = await agent.ask(message, undefined, history);
6263
res.json({ text: response });
6364
}
6465
```
6566

6667
### 2. Client-Side (React)
67-
Use the `@openknowledge/react` UI widget to interact with your secure endpoint:
68+
Use the `@openknowledge/react` UI widget to interact with your secure endpoint. The widget supports **Markdown parsing** out of the box and uses **Compound Components** for maximum flexibility:
6869

6970
```tsx
7071
import { Widget, useWidgetMessages } from '@openknowledge/react';
@@ -80,7 +81,10 @@ export default function ChatWidget() {
8081
const res = await fetch('/api/chat', {
8182
method: 'POST',
8283
headers: { 'Content-Type': 'application/json' },
83-
body: JSON.stringify({ message: text })
84+
body: JSON.stringify({
85+
message: text,
86+
history: messages // Send history to maintain context
87+
})
8488
});
8589
const data = await res.json();
8690
appendMessage({ role: 'assistant', content: data.text });
@@ -92,7 +96,11 @@ export default function ChatWidget() {
9296
return (
9397
<Widget.Root messages={messages} isProcessing={isProcessing} onSendMessage={handleSendMessage}>
9498
<Widget.Trigger />
95-
<Widget.Content />
99+
<Widget.Content>
100+
<Widget.Header />
101+
<Widget.Body />
102+
<Widget.Footer />
103+
</Widget.Content>
96104
</Widget.Root>
97105
);
98106
}
@@ -102,9 +110,9 @@ export default function ChatWidget() {
102110

103111
We welcome contributions from the community! If you're looking to make your first PR, here are a few **Good First Issues** derived from our current roadmap:
104112

105-
1. **Refactor `Widget.tsx` into Atomic Components**
106-
- **Context:** Currently, `packages/react/src/components/organisms/Widget/Widget.tsx` is a large file containing the Root, Trigger, and Content implementations.
107-
- **Task:** Refactor this using Atomic Design principles (extracting UI bits into `atoms` and `molecules`) while adhering to Vercel Composition Patterns (avoiding barrel files).
113+
1. **Add Vector Database/RAG Support Example**
114+
- **Context:** The core agent currently loads `.md` files directly from the file system, which is great for small configurations.
115+
- **Task:** Create a new example in `packages/core/examples` demonstrating how to connect the `KnowledgeRouter` (or `AgentInstance`) to a Vector Database like Pinecone, Supabase Vector, or similar using the manual initialization flow.
108116

109117
2. **Expand AI Provider Support in `@openknowledge/core`**
110118
- **Context:** The core package currently supports `openai`, `anthropic`, and `gemini` via `@tanstack/ai`.

0 commit comments

Comments
 (0)