openkbs 0.0.67 → 0.0.70

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.
Files changed (62) hide show
  1. package/README.md +1 -0
  2. package/elastic/README.md +1 -1
  3. package/elastic/functions.md +5 -5
  4. package/elastic/pulse.md +2 -2
  5. package/package.json +2 -2
  6. package/scripts/deploy.js +68 -0
  7. package/src/actions.js +7 -0
  8. package/templates/.claude/skills/openkbs/SKILL.md +37 -8
  9. package/templates/.claude/skills/openkbs/examples/monitoring-bot/README.md +55 -0
  10. package/templates/.claude/skills/openkbs/examples/monitoring-bot/app/instructions.txt +40 -0
  11. package/templates/.claude/skills/openkbs/examples/monitoring-bot/app/settings.json +41 -0
  12. package/templates/.claude/skills/openkbs/examples/monitoring-bot/openkbs.json +3 -0
  13. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/actions.js +141 -0
  14. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/handler.js +32 -0
  15. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/memoryHelpers.js +91 -0
  16. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/onCronjob.js +105 -0
  17. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/onPublicAPIRequest.js +165 -0
  18. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/onRequest.js +2 -0
  19. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Events/onResponse.js +2 -0
  20. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Frontend/contentRender.js +74 -0
  21. package/templates/.claude/skills/openkbs/examples/monitoring-bot/src/Frontend/contentRender.json +3 -0
  22. package/templates/.claude/skills/openkbs/examples/nodejs-demo/functions/auth/index.mjs +228 -0
  23. package/templates/.claude/skills/openkbs/examples/nodejs-demo/functions/auth/package.json +7 -0
  24. package/templates/.claude/skills/openkbs/examples/nodejs-demo/functions/posts/index.mjs +287 -0
  25. package/templates/.claude/skills/openkbs/examples/nodejs-demo/functions/posts/package.json +10 -0
  26. package/templates/.claude/skills/openkbs/examples/nodejs-demo/functions/settings.json +4 -0
  27. package/templates/.claude/skills/openkbs/examples/nodejs-demo/openkbs.json +16 -0
  28. package/templates/.claude/skills/openkbs/examples/nodejs-demo/site/index.html +658 -0
  29. package/templates/.claude/skills/openkbs/examples/nodejs-demo/site/settings.json +4 -0
  30. package/templates/.claude/skills/openkbs/patterns/cronjob-batch-processing.md +278 -0
  31. package/templates/.claude/skills/openkbs/patterns/cronjob-monitoring.md +341 -0
  32. package/templates/.claude/skills/openkbs/patterns/file-upload.md +205 -0
  33. package/templates/.claude/skills/openkbs/patterns/image-generation.md +139 -0
  34. package/templates/.claude/skills/openkbs/patterns/memory-system.md +264 -0
  35. package/templates/.claude/skills/openkbs/patterns/public-api-item-proxy.md +254 -0
  36. package/templates/.claude/skills/openkbs/patterns/scheduled-tasks.md +157 -0
  37. package/templates/.claude/skills/openkbs/patterns/telegram-webhook.md +424 -0
  38. package/templates/.claude/skills/openkbs/patterns/telegram.md +222 -0
  39. package/templates/.claude/skills/openkbs/patterns/vectordb-archive.md +231 -0
  40. package/templates/.claude/skills/openkbs/patterns/video-generation.md +145 -0
  41. package/templates/.claude/skills/openkbs/patterns/web-publishing.md +257 -0
  42. package/templates/.claude/skills/openkbs/reference/backend-sdk.md +13 -2
  43. package/templates/.claude/skills/openkbs/reference/elastic-services.md +61 -29
  44. package/templates/platform/README.md +15 -50
  45. package/templates/platform/agents/assistant/app/icon.png +0 -0
  46. package/templates/platform/agents/assistant/app/instructions.txt +9 -21
  47. package/templates/platform/agents/assistant/app/settings.json +11 -15
  48. package/templates/platform/agents/assistant/src/Events/actions.js +31 -62
  49. package/templates/platform/agents/assistant/src/Events/handler.js +54 -0
  50. package/templates/platform/agents/assistant/src/Events/onRequest.js +3 -0
  51. package/templates/platform/agents/assistant/src/Events/onRequest.json +5 -0
  52. package/templates/platform/agents/assistant/src/Events/onResponse.js +2 -40
  53. package/templates/platform/agents/assistant/src/Events/onResponse.json +4 -2
  54. package/templates/platform/agents/assistant/src/Frontend/contentRender.js +17 -16
  55. package/templates/platform/agents/assistant/src/Frontend/contentRender.json +1 -1
  56. package/templates/platform/functions/api/index.mjs +17 -23
  57. package/templates/platform/functions/api/package.json +4 -0
  58. package/templates/platform/openkbs.json +7 -2
  59. package/templates/platform/site/index.html +18 -19
  60. package/version.json +3 -3
  61. package/templates/.claude/skills/openkbs/examples/ai-copywriter-agent/scripts/run_job.js +0 -26
  62. package/templates/.claude/skills/openkbs/examples/ai-copywriter-agent/scripts/utils/agent_client.js +0 -265
@@ -18,7 +18,7 @@ OpenKBS provides managed cloud infrastructure that scales automatically.
18
18
  "elastic": {
19
19
  "functions": {
20
20
  "hello": {
21
- "runtime": "nodejs22.x",
21
+ "runtime": "nodejs24.x",
22
22
  "memory": 512,
23
23
  "timeout": 30
24
24
  }
@@ -76,17 +76,25 @@ openkbs fn invoke hello '{"test": true}' # Invoke function
76
76
 
77
77
  ### Supported Runtimes
78
78
 
79
- - `nodejs22.x`, `nodejs20.x`, `nodejs18.x`
80
- - `python3.12`, `python3.11`
81
- - `java21`, `java17`
79
+ - `nodejs24.x`, `nodejs22.x`, `nodejs20.x`
80
+ - `python3.14`, `python3.13`
81
+ - `java25`, `java21`
82
82
 
83
- ### Access from Agent
83
+ ### Access URLs
84
+
85
+ Functions are accessible via CloudFront on your whitelabel domain:
86
+
87
+ ```
88
+ https://yourdomain.com/functionName
89
+ ```
90
+
91
+ From frontend (site/), use relative paths:
84
92
 
85
93
  ```javascript
86
- // In actions.js
87
- const response = await fetch('https://fn.openkbs.com/YOUR_KB_ID/hello', {
94
+ const response = await fetch('/api', {
88
95
  method: 'POST',
89
- body: JSON.stringify({ data: 'value' })
96
+ headers: { 'Content-Type': 'application/json' },
97
+ body: JSON.stringify({ action: 'hello' })
90
98
  });
91
99
  ```
92
100
 
@@ -106,7 +114,7 @@ openkbs postgres status # Show database info
106
114
 
107
115
  ### Access from Agent
108
116
 
109
- Connection string is available as `POSTGRES_URL` environment variable:
117
+ Connection string is available as `DATABASE_URL` environment variable:
110
118
 
111
119
  ```javascript
112
120
  // In onRequest.js or actions.js
@@ -114,7 +122,7 @@ import pg from 'pg';
114
122
  const { Pool } = pg;
115
123
 
116
124
  const pool = new Pool({
117
- connectionString: process.env.POSTGRES_URL,
125
+ connectionString: process.env.DATABASE_URL,
118
126
  ssl: { rejectUnauthorized: false }
119
127
  });
120
128
 
@@ -162,18 +170,20 @@ console.log(uploaded.url); // Public URL
162
170
 
163
171
  // Get presigned URL for upload
164
172
  const presigned = await openkbs.kb({
165
- action: 'getPresignedUploadUrl',
166
- filename: 'document.pdf',
167
- contentType: 'application/pdf'
173
+ action: 'createPresignedURL',
174
+ namespace: 'files',
175
+ fileName: 'document.pdf',
176
+ fileType: 'application/pdf',
177
+ presignedOperation: 'putObject'
168
178
  });
169
- // Returns: { uploadUrl, publicUrl }
179
+ // Returns presigned URL string - upload with axios.put()
170
180
  ```
171
181
 
172
182
  ---
173
183
 
174
184
  ## Pulse (WebSocket)
175
185
 
176
- Real-time messaging and pub/sub.
186
+ Real-time messaging and pub/sub via SDK.
177
187
 
178
188
  ### CLI Commands
179
189
 
@@ -182,21 +192,43 @@ openkbs pulse status # Show Pulse status
182
192
  openkbs pulse channels # List channels
183
193
  ```
184
194
 
185
- ### Access from Agent
195
+ ### Backend (Lambda functions)
186
196
 
187
197
  ```javascript
188
- // Publish message
189
- await openkbs.pulse.publish('channel-name', {
190
- type: 'notification',
191
- data: { message: 'Hello subscribers!' }
198
+ import pulse from 'openkbs-pulse/server';
199
+
200
+ // Get token for frontend
201
+ const tokenData = await pulse.getToken(kbId, apiKey, userId);
202
+ // Returns: { token, endpoint }
203
+
204
+ // Publish to channel
205
+ await pulse.publish('posts', 'new_post', { post }, { kbId, apiKey });
206
+
207
+ // Get presence
208
+ const presence = await pulse.presence('posts', { kbId, apiKey });
209
+ ```
210
+
211
+ ### Frontend (Browser)
212
+
213
+ ```html
214
+ <script src="https://unpkg.com/openkbs-pulse/pulse.js"></script>
215
+ ```
216
+
217
+ ```javascript
218
+ // Connect (token from backend)
219
+ const realtime = new Pulse.Realtime({ kbId, token, endpoint, clientId });
220
+
221
+ // Subscribe to channel
222
+ const channel = realtime.channels.get('posts');
223
+ channel.subscribe('new_post', (message) => {
224
+ console.log('New post:', message.data);
192
225
  });
193
226
 
194
- // Subscribe (frontend)
195
- const ws = new WebSocket(`wss://pulse.openkbs.com/${kbId}/channel-name`);
196
- ws.onmessage = (event) => {
197
- const data = JSON.parse(event.data);
198
- console.log('Received:', data);
199
- };
227
+ // Presence
228
+ channel.presence.enter({ name: 'Alice' });
229
+ channel.presence.subscribe((members) => {
230
+ console.log('Online:', members.length);
231
+ });
200
232
  ```
201
233
 
202
234
  ### Use Cases
@@ -218,7 +250,7 @@ Complete Node.js application with all services:
218
250
  {
219
251
  "elastic": {
220
252
  "functions": {
221
- "api": { "runtime": "nodejs22.x", "memory": 512 }
253
+ "api": { "runtime": "nodejs24.x", "memory": 512 }
222
254
  },
223
255
  "postgres": true,
224
256
  "storage": true,
@@ -234,7 +266,7 @@ import pg from 'pg';
234
266
  const { Pool } = pg;
235
267
 
236
268
  const pool = new Pool({
237
- connectionString: process.env.POSTGRES_URL,
269
+ connectionString: process.env.DATABASE_URL,
238
270
  ssl: { rejectUnauthorized: false }
239
271
  });
240
272
 
@@ -304,7 +336,7 @@ import psycopg2
304
336
  import os
305
337
 
306
338
  def handler(event, context):
307
- conn = psycopg2.connect(os.environ['POSTGRES_URL'])
339
+ conn = psycopg2.connect(os.environ['DATABASE_URL'])
308
340
  cur = conn.cursor()
309
341
  cur.execute("SELECT * FROM items")
310
342
  rows = cur.fetchall()
@@ -1,70 +1,35 @@
1
- # {{APP_NAME}} Platform
1
+ # {{APP_NAME}}
2
2
 
3
- OpenKBS full-stack platform with AI agents, serverless functions, and static site.
3
+ OpenKBS full-stack platform with Postgres, Storage+CloudFront, and Pulse.
4
4
 
5
5
  ## Structure
6
6
 
7
7
  ```
8
8
  {{APP_NAME}}/
9
- ├── agents/ # AI agents
10
- │ └── assistant/ # Sample assistant agent
11
- ├── app/
12
- ├── settings.json
13
- │ │ └── instructions.txt
14
- └── src/
15
- │ ├── Events/
16
- │ └── Frontend/
17
- ├── functions/ # Serverless Lambda functions
18
- │ └── api/
19
- │ └── index.mjs # Sample API endpoint
20
- ├── site/ # Static site for whitelabel
21
- │ └── index.html
22
- ├── openkbs.json # Elastic services configuration
23
- └── README.md
9
+ ├── openkbs.json # Elastic services config
10
+ ├── agents/ # AI agents (optional)
11
+ ├── functions/
12
+ └── api/ # Serverless function
13
+ └── site/
14
+ └── index.html # Static site
24
15
  ```
25
16
 
26
17
  ## Deploy
27
18
 
28
19
  ```bash
29
- # Deploy elastic services (postgres, storage, pulse)
20
+ # Deploy elastic services
30
21
  openkbs deploy
31
22
 
32
- # Deploy the API function
23
+ # Deploy function
33
24
  openkbs fn push api
34
25
 
35
- # Deploy static site
26
+ # Deploy site
36
27
  openkbs site push
37
-
38
- # Deploy an agent
39
- cd agents/assistant
40
- openkbs push
41
28
  ```
42
29
 
43
30
  ## Elastic Services
44
31
 
45
- Enabled in `openkbs.json`:
46
-
47
- - **Postgres**: `openkbs postgres shell` to connect
48
- - **Storage**: `openkbs storage ls` to list files
49
- - **Pulse**: `openkbs pulse status` for WebSocket info
50
- - **Functions**: `openkbs fn list` to see deployed functions
51
-
52
- ## Development
53
-
54
- ```bash
55
- # Check stack status
56
- openkbs stack status
57
-
58
- # View function logs
59
- openkbs fn logs api
60
-
61
- # Invoke function locally
62
- openkbs fn invoke api '{"action": "hello"}'
63
- ```
64
-
65
- ## URLs
66
-
67
- After deployment:
68
- - Site: `https://YOUR_DOMAIN/`
69
- - API: `https://fn.openkbs.com/YOUR_KB_ID/api`
70
- - Agent: `https://YOUR_KB_ID.apps.openkbs.com`
32
+ - **Postgres**: `openkbs postgres shell`
33
+ - **Storage**: `openkbs storage ls` (CDN at /media/*)
34
+ - **Pulse**: `openkbs pulse status`
35
+ - **Functions**: `openkbs fn list`
@@ -1,25 +1,13 @@
1
- You are an AI assistant for {{APP_NAME}}.
1
+ You are an AI assistant, assist users with their inquiries and tasks efficiently.
2
2
 
3
- ## Available Commands
3
+ LIST OF AVAILABLE COMMANDS:
4
+ To execute a command, output it as text message and wait for system response.
4
5
 
5
6
  <googleSearch>
6
- {"query": "search terms"}
7
+ {
8
+ "query": "search query"
9
+ }
7
10
  </googleSearch>
8
- Search the web for information.
9
-
10
- <setMemory>
11
- {"itemId": "memory_key", "value": "data to remember"}
12
- </setMemory>
13
- Save data to memory. The itemId must start with "memory_".
14
-
15
- <deleteItem>
16
- {"itemId": "memory_key"}
17
- </deleteItem>
18
- Delete a memory item.
19
-
20
- ## Guidelines
21
-
22
- 1. Be helpful and concise
23
- 2. Use commands when needed to assist the user
24
- 3. Remember important information using setMemory
25
- 4. Search the web when you need current information
11
+ Description: """
12
+ Get results from Google Search API.
13
+ """
@@ -1,17 +1,13 @@
1
1
  {
2
- "kbTitle": "{{APP_NAME}} Assistant",
3
- "kbDescription": "AI assistant for {{APP_NAME}} platform",
4
- "model": "anthropic/claude-sonnet-4-20250514",
5
- "maxTokens": 16000,
6
- "itemTypes": {
7
- "memory": {
8
- "attributes": [
9
- { "attrName": "itemId", "attrType": "itemId", "encrypted": false },
10
- { "attrName": "body", "attrType": "body", "encrypted": true }
11
- ]
12
- }
13
- },
14
- "options": {
15
- "priorityItems": [{ "prefix": "memory_", "limit": 50 }]
16
- }
2
+ "chatVendor": "google",
3
+ "kbDescription": "{{{openkbsAppName}}}",
4
+ "kbTitle": "{{{openkbsAppName}}}",
5
+ "model": "gemini-3-pro",
6
+ "inputTools": [
7
+ "speechToText"
8
+ ],
9
+ "embeddingModel": "text-embedding-3-large",
10
+ "embeddingDimension": 3072,
11
+ "searchEngine": "VectorDB",
12
+ "itemTypes": {}
17
13
  }
@@ -1,81 +1,50 @@
1
- /**
2
- * Command actions for {{APP_NAME}} Assistant
3
- */
4
-
5
1
  export const getActions = (meta, event) => [
6
- // Google Search
2
+ // Google Search with JSON
3
+ // Usage: <googleSearch>{"query": "search terms"}</googleSearch>
7
4
  [/<googleSearch>([\s\S]*?)<\/googleSearch>/s, async (match) => {
8
5
  try {
9
6
  const data = JSON.parse(match[1].trim());
10
- const results = await openkbs.googleSearch(data.query);
11
-
12
- const formatted = results?.slice(0, 5).map(({ title, link, snippet }) => ({
13
- title, link, snippet
7
+ const response = await openkbs.googleSearch(data.query);
8
+ const results = response?.map(({ title, link, snippet, pagemap }) => ({
9
+ title,
10
+ link,
11
+ snippet,
12
+ image: pagemap?.metatags?.[0]?.["og:image"]
14
13
  }));
15
-
16
- return {
17
- type: 'SEARCH_RESULTS',
18
- data: formatted,
19
- ...meta,
20
- _meta_actions: ["REQUEST_CHAT_MODEL"]
21
- };
14
+ return { data: results, ...meta };
22
15
  } catch (e) {
23
- return { error: e.message, ...meta, _meta_actions: ["REQUEST_CHAT_MODEL"] };
16
+ return { error: e.message, ...meta };
24
17
  }
25
18
  }],
26
19
 
27
- // Set Memory
28
- [/<setMemory>([\s\S]*?)<\/setMemory>/s, async (match) => {
20
+ // MCP (Model Context Protocol) Tool Handler
21
+ // Automatically handles all MCP tool calls: <mcp_{server}_{toolName}>{params}</mcp_{server}_{toolName}>
22
+ // Configure MCP servers in settings.json: { "options": { "mcpServers": { "github": {} } } }
23
+ // Add required secrets (e.g., GITHUB_PERSONAL_ACCESS_TOKEN) in KB secrets
24
+ [/<mcp_([a-z0-9-]+)_([a-z0-9_]+)>([\s\S]*?)<\/mcp_\1_\2>/s, async (match) => {
29
25
  try {
30
- const data = JSON.parse(match[1].trim());
31
-
32
- if (!data.itemId?.startsWith('memory_')) {
33
- return {
34
- type: "MEMORY_ERROR",
35
- error: "itemId must start with 'memory_'",
36
- _meta_actions: ["REQUEST_CHAT_MODEL"]
37
- };
38
- }
39
-
40
- try {
41
- await openkbs.updateItem({
42
- itemType: 'memory',
43
- itemId: data.itemId,
44
- body: { value: data.value, updatedAt: new Date().toISOString() }
45
- });
46
- } catch (e) {
47
- await openkbs.createItem({
48
- itemType: 'memory',
49
- itemId: data.itemId,
50
- body: { value: data.value, updatedAt: new Date().toISOString() }
51
- });
52
- }
26
+ const server = match[1];
27
+ const toolName = match[2];
28
+ const args = match[3].trim() ? JSON.parse(match[3].trim()) : {};
53
29
 
30
+ const result = await openkbs.mcp.callTool(server, toolName, args);
54
31
  return {
55
- type: "MEMORY_SAVED",
56
- itemId: data.itemId,
32
+ type: 'MCP_RESULT',
33
+ server,
34
+ tool: toolName,
35
+ data: result?.content || [],
57
36
  ...meta,
58
- _meta_actions: ["REQUEST_CHAT_MODEL"]
37
+ _meta_actions: ['REQUEST_CHAT_MODEL']
59
38
  };
60
39
  } catch (e) {
61
- return { error: e.message, ...meta, _meta_actions: ["REQUEST_CHAT_MODEL"] };
62
- }
63
- }],
64
-
65
- // Delete Item
66
- [/<deleteItem>([\s\S]*?)<\/deleteItem>/s, async (match) => {
67
- try {
68
- const data = JSON.parse(match[1].trim());
69
- await openkbs.deleteItem(data.itemId);
70
-
71
40
  return {
72
- type: "ITEM_DELETED",
73
- itemId: data.itemId,
41
+ type: 'MCP_ERROR',
42
+ error: e.message,
74
43
  ...meta,
75
- _meta_actions: ["REQUEST_CHAT_MODEL"]
44
+ _meta_actions: ['REQUEST_CHAT_MODEL']
76
45
  };
77
- } catch (e) {
78
- return { error: e.message, ...meta, _meta_actions: ["REQUEST_CHAT_MODEL"] };
79
46
  }
80
- }]
81
- ];
47
+ }],
48
+
49
+ // add more actions here
50
+ ];
@@ -0,0 +1,54 @@
1
+ import { getActions } from './actions.js';
2
+
3
+ export const backendHandler = async (event) => {
4
+ const meta = { _meta_actions: ["REQUEST_CHAT_MODEL"] };
5
+ const lastMessage = event.payload.messages[event.payload.messages.length - 1];
6
+ const actions = getActions(meta, event);
7
+
8
+ const matchingActions = [];
9
+ actions.forEach(([regex, action]) => {
10
+ const matches = [...(lastMessage.content || '').matchAll(new RegExp(regex, 'g'))];
11
+ matches.forEach(match => {
12
+ matchingActions.push(action(match, event));
13
+ });
14
+ });
15
+
16
+ if (matchingActions.length > 0) {
17
+ try {
18
+ const results = await Promise.all(matchingActions);
19
+
20
+ // Check if any result needs LLM callback
21
+ const needsChatModel = results.some(r =>
22
+ r?._meta_actions?.includes('REQUEST_CHAT_MODEL')
23
+ );
24
+
25
+ // Handle image data for LLM vision
26
+ if (results.some(r => r?.data?.some?.(item => item?.type === 'image_url'))) {
27
+ return {
28
+ ...results[0],
29
+ _meta_actions: needsChatModel ? ["REQUEST_CHAT_MODEL"] : []
30
+ };
31
+ }
32
+
33
+ // Single result - return as is
34
+ if (results.length === 1) {
35
+ return results[0];
36
+ }
37
+
38
+ // Multiple results
39
+ return {
40
+ type: 'MULTI_RESPONSE',
41
+ data: results,
42
+ _meta_actions: needsChatModel ? ["REQUEST_CHAT_MODEL"] : []
43
+ };
44
+ } catch (error) {
45
+ return {
46
+ type: 'ERROR',
47
+ error: error.message,
48
+ ...meta
49
+ };
50
+ }
51
+ }
52
+
53
+ return { type: 'CONTINUE' };
54
+ };
@@ -0,0 +1,3 @@
1
+ import {backendHandler} from './handler';
2
+
3
+ export const handler = async (event) => backendHandler(event)
@@ -0,0 +1,5 @@
1
+ {
2
+ "dependencies": {
3
+
4
+ }
5
+ }
@@ -1,41 +1,3 @@
1
- import { getActions } from './actions.js';
1
+ import {backendHandler} from './handler';
2
2
 
3
- export const handler = async (event) => {
4
- const response = event?.payload?.response?.content ?? event?.payload?.response;
5
- if (!response) return { type: 'EMPTY_RESPONSE' };
6
-
7
- const meta = {
8
- role: 'tool',
9
- name: 'command_executor',
10
- msgId: `msg_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`
11
- };
12
-
13
- const actions = getActions(meta, event);
14
- const results = [];
15
-
16
- for (const [pattern, handler] of actions) {
17
- const matches = response.matchAll(new RegExp(pattern.source, pattern.flags + 'g'));
18
- for (const match of matches) {
19
- results.push(handler(match));
20
- }
21
- }
22
-
23
- if (results.length === 0) {
24
- return { type: 'NO_COMMANDS', _meta_actions: [] };
25
- }
26
-
27
- const resolved = await Promise.all(results);
28
-
29
- if (resolved.length === 1) {
30
- return resolved[0];
31
- }
32
-
33
- return {
34
- type: 'MULTI_COMMAND_RESULT',
35
- results: resolved,
36
- ...meta,
37
- _meta_actions: resolved.some(r => r._meta_actions?.includes("REQUEST_CHAT_MODEL"))
38
- ? ["REQUEST_CHAT_MODEL"]
39
- : []
40
- };
41
- };
3
+ export const handler = async (event) => backendHandler(event)
@@ -1,3 +1,5 @@
1
1
  {
2
- "dependencies": {}
3
- }
2
+ "dependencies": {
3
+
4
+ }
5
+ }
@@ -1,26 +1,27 @@
1
- import React from 'react';
1
+ import React, {useEffect} from 'react';
2
2
 
3
3
  const onRenderChatMessage = async (params) => {
4
- const { content, role } = params.messages[params.msgIndex];
4
+ const { content } = params.messages[params.msgIndex];
5
+ }
5
6
 
6
- // Hide tool messages
7
- if (role === 'tool') {
8
- return JSON.stringify({ type: 'HIDDEN_MESSAGE' });
9
- }
10
-
11
- return null; // Default rendering
12
- };
13
-
14
- const Header = ({ setRenderSettings }) => {
15
- React.useEffect(() => {
7
+ const Header = ({ setRenderSettings}) => {
8
+ useEffect(() => {
16
9
  setRenderSettings({
17
- disableBalanceView: true
10
+ disableShareButton: true,
11
+ disableBalanceView: true,
12
+ disableSentLabel: false,
13
+ disableChatAvatar: false,
14
+ disableChatModelsSelect: false,
15
+ disableContextItems: false,
16
+ disableCopyButton: false,
17
+ disableEmojiButton: false,
18
+ disableTextToSpeechButton: false,
19
+ disableMobileLeftButton: false,
18
20
  });
19
21
  }, [setRenderSettings]);
20
22
 
21
- return null;
22
- };
23
+ }
23
24
 
24
25
  const exports = { onRenderChatMessage, Header };
25
26
  window.contentRender = exports;
26
- export default exports;
27
+ export default exports;
@@ -7,4 +7,4 @@
7
7
  "@emotion/react": "^11.10.6 (fixed)",
8
8
  "@emotion/styled": "^11.10.6 (fixed)"
9
9
  }
10
- }
10
+ }