@gram-ai/elements 1.0.8 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -3
- package/dist/elements.js +8234 -14234
- package/dist/index-BfPvCJYI.js +6539 -0
- package/dist/server.d.ts +5 -5
- package/dist/server.js +10568 -0
- package/dist/types/index.d.ts +11 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -18,14 +18,16 @@ pnpm add @gram-ai/elements
|
|
|
18
18
|
|
|
19
19
|
## Setting up your backend
|
|
20
20
|
|
|
21
|
-
At the moment, we provide a set of handlers via the `@gram-ai/elements/server` package that you can use to automatically setup your backend for usage with Gram Elements. The example below demonstrates the setup for
|
|
21
|
+
At the moment, we provide a set of handlers via the `@gram-ai/elements/server` package that you can use to automatically setup your backend for usage with Gram Elements. The example below demonstrates the setup for Express:
|
|
22
22
|
|
|
23
23
|
```typescript
|
|
24
|
-
import { Hono } from 'hono'
|
|
25
24
|
import { createElementsServerHandlers } from '@gram-ai/elements/server'
|
|
25
|
+
import express from 'express'
|
|
26
26
|
|
|
27
|
-
const app = new Hono()
|
|
28
27
|
const handlers = createElementsServerHandlers()
|
|
28
|
+
const app = express()
|
|
29
|
+
|
|
30
|
+
app.use(express.json())
|
|
29
31
|
|
|
30
32
|
app.post('/chat/completions', handlers.chat)
|
|
31
33
|
```
|
|
@@ -50,6 +52,8 @@ import '@gram-ai/elements/elements.css'
|
|
|
50
52
|
const config: ElementsConfig = {
|
|
51
53
|
projectSlug: 'xxx',
|
|
52
54
|
mcp: 'https://app.getgram.ai/mcp/{your_slug}',
|
|
55
|
+
// Points to your backend endpoint
|
|
56
|
+
chatEndpoint: '/chat/completions',
|
|
53
57
|
variant: 'widget',
|
|
54
58
|
welcome: {
|
|
55
59
|
title: 'Hello!',
|