@gram-ai/elements 1.0.9 → 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 +1 -1
- 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!',
|
package/dist/elements.js
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -20,9 +20,20 @@ export interface ElementsConfig {
|
|
|
20
20
|
/**
|
|
21
21
|
* The Gram Server URL to use for the Elements library.
|
|
22
22
|
* Can be retrieved from https://app.getgram.ai/{team}/{project}/mcp/{mcp_slug}
|
|
23
|
+
*
|
|
23
24
|
* Note: This config option will likely change in the future
|
|
24
25
|
*/
|
|
25
26
|
mcp: ServerUrl;
|
|
27
|
+
/**
|
|
28
|
+
* The path of your backend's chat endpoint.
|
|
29
|
+
* @default '/chat/completions'
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* const config: ElementsConfig = {
|
|
33
|
+
* chatEndpoint: '/my-custom-chat-endpoint',
|
|
34
|
+
* }
|
|
35
|
+
*/
|
|
36
|
+
chatEndpoint?: string;
|
|
26
37
|
/**
|
|
27
38
|
* Custom environment variable overrides for the Elements library.
|
|
28
39
|
* Will be used to override the environment variables for the MCP server.
|
package/package.json
CHANGED