@promptbook/cli 0.103.0-47 → 0.103.0-48
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/apps/agents-server/TODO.txt +2 -2
- package/apps/agents-server/config.ts.todo +5 -279
- package/apps/agents-server/src/app/agents/[agentName]/api/chat/route.ts +7 -1
- package/apps/agents-server/src/app/agents/[agentName]/book/BookEditorWrapper.tsx +2 -2
- package/apps/agents-server/src/app/agents/[agentName]/book+chat/AgentBookAndChatComponent.tsx +2 -4
- package/apps/agents-server/src/app/agents/[agentName]/page.tsx +2 -2
- package/apps/agents-server/src/app/api/upload/route.ts +0 -4
- package/apps/agents-server/src/{supabase/getSupabase.ts → database/$provideSupabase.ts} +11 -7
- package/apps/agents-server/src/{supabase/getSupabaseForBrowser.ts → database/$provideSupabaseForBrowser.ts} +9 -5
- package/apps/agents-server/src/{supabase/getSupabaseForServer.ts → database/$provideSupabaseForServer.ts} +4 -4
- package/apps/agents-server/src/{supabase/getSupabaseForWorker.ts → database/$provideSupabaseForWorker.ts} +5 -4
- package/apps/agents-server/src/database/schema.sql +131 -0
- package/apps/agents-server/src/database/schema.ts +217 -0
- package/apps/agents-server/src/tools/$provideAgentCollectionForServer.ts +3 -3
- package/apps/agents-server/src/tools/$provideOpenAiAssistantExecutionToolsForServer.ts +1 -1
- package/apps/agents-server/src/utils/cdn/utils/getUserFileCdnKey.ts +2 -1
- package/esm/index.es.js +166 -21
- package/esm/index.es.js.map +1 -1
- package/esm/typings/src/_packages/core.index.d.ts +6 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/agent-source/AgentBasicInformation.d.ts +7 -3
- package/esm/typings/src/book-2.0/agent-source/AgentSourceParseResult.d.ts +2 -1
- package/esm/typings/src/book-2.0/agent-source/computeAgentHash.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/computeAgentHash.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/createDefaultAgentName.d.ts +8 -0
- package/esm/typings/src/book-2.0/agent-source/normalizeAgentName.d.ts +9 -0
- package/esm/typings/src/book-2.0/agent-source/normalizeAgentName.test.d.ts +1 -0
- package/esm/typings/src/book-2.0/agent-source/parseAgentSourceWithCommitments.d.ts +1 -1
- package/esm/typings/src/collection/agent-collection/constructors/agent-collection-in-supabase/AgentsDatabaseSchema.d.ts +57 -32
- package/esm/typings/src/llm-providers/_common/utils/assertUniqueModels.d.ts +12 -0
- package/esm/typings/src/llm-providers/agent/Agent.d.ts +7 -2
- package/esm/typings/src/llm-providers/agent/AgentLlmExecutionTools.d.ts +4 -0
- package/esm/typings/src/llm-providers/agent/RemoteAgent.d.ts +2 -2
- package/esm/typings/src/llm-providers/openai/OpenAiAssistantExecutionTools.d.ts +24 -3
- package/esm/typings/src/llm-providers/openai/openai-models.test.d.ts +4 -0
- package/esm/typings/src/remote-server/startAgentServer.d.ts +1 -1
- package/esm/typings/src/remote-server/startRemoteServer.d.ts +1 -2
- package/esm/typings/src/transpilers/openai-sdk/register.d.ts +1 -1
- package/esm/typings/src/types/typeAliases.d.ts +6 -0
- package/esm/typings/src/utils/normalization/normalize-to-kebab-case.d.ts +2 -0
- package/esm/typings/src/utils/normalization/normalizeTo_PascalCase.d.ts +3 -0
- package/esm/typings/src/utils/normalization/normalizeTo_camelCase.d.ts +2 -0
- package/esm/typings/src/utils/normalization/titleToName.d.ts +2 -0
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +167 -22
- package/umd/index.umd.js.map +1 -1
- package/apps/agents-server/src/supabase/TODO.txt +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
TODO: !!!! Tests of
|
|
2
|
-
TODO: !!!! Make the agents live here
|
|
1
|
+
TODO: !!!! Tests of the agents server should be in main testing pipeline
|
|
2
|
+
TODO: !!!! Make the agents live here and act here
|
|
3
3
|
TODO: !!!! Publish `agents-server` this as Docker container
|
|
4
4
|
TODO: !!!! Publish `@promptbook/agents-server` to npm
|
|
5
5
|
TODO: !!!! Work `ptbk start-pipelines-server` / `ptbk start-agents-server` CLI command to start this server
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
// TODO: Use
|
|
1
|
+
// TODO: !!!! Use the configuration from ConfigChecker
|
|
2
|
+
// TODO: !!!! Load config from `EnvironmentVariable` table, `EnvironmentVariable` has priority over `process.env` from `.env`
|
|
3
|
+
// TODO: !!!! Move variables from Vercel -> Supabase
|
|
4
|
+
|
|
5
|
+
|
|
2
6
|
|
|
3
7
|
import { CLI_APP_ID } from '@promptbook/core';
|
|
4
8
|
import { string_app_id } from '@promptbook/types';
|
|
@@ -26,287 +30,9 @@ const config = ConfigChecker.from({
|
|
|
26
30
|
// Note: To expose env variables to the browser, using this seemingly strange syntax:
|
|
27
31
|
// @see https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables#exposing-environment-variables-to-the-browser
|
|
28
32
|
NEXT_PUBLIC_URL: process.env.NEXT_PUBLIC_URL,
|
|
29
|
-
NEXT_PUBLIC_VERCEL_BRANCH_URL: process.env.NEXT_PUBLIC_VERCEL_BRANCH_URL,
|
|
30
|
-
NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF: process.env.NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF,
|
|
31
|
-
NEXT_PUBLIC_PROMPTBOOK_SERVER_URL: process.env.NEXT_PUBLIC_PROMPTBOOK_SERVER_URL,
|
|
32
|
-
NEXT_PUBLIC_IMAGE_SERVER_URL: process.env.NEXT_PUBLIC_IMAGE_SERVER_URL,
|
|
33
|
-
NEXT_PUBLIC_BROWSER_SERVER_URL: process.env.NEXT_PUBLIC_BROWSER_SERVER_URL,
|
|
34
|
-
NEXT_PUBLIC_OUR_DOMAINS: process.env.NEXT_PUBLIC_OUR_DOMAINS,
|
|
35
|
-
NEXT_PUBLIC_SUPABASE_URL: process.env.NEXT_PUBLIC_SUPABASE_URL,
|
|
36
|
-
NEXT_PUBLIC_SUPABASE_ANON_KEY: process.env.NEXT_PUBLIC_SUPABASE_ANON_KEY,
|
|
37
33
|
|
|
38
|
-
// Auth service environment variables
|
|
39
|
-
NEXT_PUBLIC_FACEBOOK_APP_ID: process.env.NEXT_PUBLIC_FACEBOOK_APP_ID,
|
|
40
|
-
NEXT_PUBLIC_LINKEDIN_CLIENT_ID: process.env.NEXT_PUBLIC_LINKEDIN_CLIENT_ID,
|
|
41
|
-
NEXT_PUBLIC_GITHUB_CLIENT_ID: process.env.NEXT_PUBLIC_GITHUB_CLIENT_ID,
|
|
42
|
-
NEXT_PUBLIC_GOOGLE_CLIENT_ID: process.env.NEXT_PUBLIC_GOOGLE_CLIENT_ID,
|
|
43
34
|
});
|
|
44
35
|
|
|
45
36
|
export const NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF = config.get('NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF').value;
|
|
46
37
|
|
|
47
38
|
const NEXT_PUBLIC_VERCEL_BRANCH_URL = config.get('NEXT_PUBLIC_VERCEL_BRANCH_URL').value;
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* TODO: [🧠] Maybe rename to NEXT_PUBLIC_WEBGPT_URL
|
|
51
|
-
*/
|
|
52
|
-
export const NEXT_PUBLIC_URL = NEXT_PUBLIC_VERCEL_BRANCH_URL
|
|
53
|
-
? NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF === 'main'
|
|
54
|
-
? // Production:
|
|
55
|
-
config.get('NEXT_PUBLIC_URL').url().required().value
|
|
56
|
-
: // Preview branch:
|
|
57
|
-
new URL(`https://${NEXT_PUBLIC_VERCEL_BRANCH_URL}/`)
|
|
58
|
-
: // Local development:
|
|
59
|
-
config.get('NEXT_PUBLIC_URL').url().required().value;
|
|
60
|
-
|
|
61
|
-
export const ADMIN_GITHUB_NAME: string_name = 'hejny';
|
|
62
|
-
export const ADMIN_EMAIL: EmailAddress = parseEmailAddress('pavol@webgpt.cz');
|
|
63
|
-
export const BOT_EMAIL: EmailAddress = parseEmailAddress('bot@bot.webgpt.cz');
|
|
64
|
-
export const RUKA_DOMAIN: string_domain = validateDomain('bot.webgpt.cz');
|
|
65
|
-
export const BOT_SIGNATURE: string_maxdown = maxdown`[✨ ${APP_NAME} Bot](${NEXT_PUBLIC_URL.href})`;
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* 🌒 Default color mode for Promptbook studio
|
|
69
|
-
*
|
|
70
|
-
* Note: This will be used in rare cases because most of the time system settings will be present
|
|
71
|
-
* Note: Use 🌒 dark mode for promptbook studio and miniapps
|
|
72
|
-
*/
|
|
73
|
-
export const DEFAULT_STUDIO_LIGHT_MODE_DARK_MODE: LightModeDarkMode = 'DARK';
|
|
74
|
-
|
|
75
|
-
/**
|
|
76
|
-
* 🌒 Default color mode for miniapps
|
|
77
|
-
*
|
|
78
|
-
* Note: This can be overridden by the miniapp itself
|
|
79
|
-
*/
|
|
80
|
-
export const DEFAULT_MINIAPP_LIGHT_MODE_DARK_MODE: LightModeDarkMode = 'LIGHT';
|
|
81
|
-
|
|
82
|
-
export const USE_DALLE_VERSION: 2 | 3 = 3;
|
|
83
|
-
|
|
84
|
-
export const USE_DALLE_MODEL_SETTINGS: DallePrompt['modelSettings'] = {
|
|
85
|
-
style: 'vivid',
|
|
86
|
-
quality: `standard`,
|
|
87
|
-
// <- TODO: !! Play with theeese to achieve best results
|
|
88
|
-
};
|
|
89
|
-
|
|
90
|
-
export const NEXT_PUBLIC_PROMPTBOOK_SERVER_URL = config.get('NEXT_PUBLIC_PROMPTBOOK_SERVER_URL').url().required().value;
|
|
91
|
-
export const NEXT_PUBLIC_IMAGE_SERVER_URL = config.get('NEXT_PUBLIC_IMAGE_SERVER_URL').url().required().value;
|
|
92
|
-
export const NEXT_PUBLIC_BROWSER_SERVER_URL = config.get('NEXT_PUBLIC_BROWSER_SERVER_URL').url().required().value;
|
|
93
|
-
|
|
94
|
-
export const IS_DEVELOPMENT =
|
|
95
|
-
isUrlOnPrivateNetwork(
|
|
96
|
-
NEXT_PUBLIC_URL,
|
|
97
|
-
); /* <- TODO: Maybe pass NODE_ENV and not assume that local is automatically dev */
|
|
98
|
-
export const IS_PRODUCTION = !IS_DEVELOPMENT;
|
|
99
|
-
|
|
100
|
-
if (isRunningInBrowser()) {
|
|
101
|
-
const enviromentLogText = IS_DEVELOPMENT ? ' (in development mode)' : '';
|
|
102
|
-
const branchLogText =
|
|
103
|
-
NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF && NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF !== 'main'
|
|
104
|
-
? ` (branch ${NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF})`
|
|
105
|
-
: '';
|
|
106
|
-
|
|
107
|
-
// TODO: Also log " client ${provideClientIdWithoutValidation()}" and avoid error unhandledRejection ReferenceError: window is not defined @see https://vercel.com/hejny/1-2i/E2LhCdVbk9hjEa8dE9ww42vnkcTg
|
|
108
|
-
console.info(
|
|
109
|
-
`%c✨ ${APP_NAME}${enviromentLogText}${branchLogText} version ${APP_VERSION} running on ${NEXT_PUBLIC_URL.href} `,
|
|
110
|
-
spaceTrim(`
|
|
111
|
-
display: block;
|
|
112
|
-
|
|
113
|
-
background-color: rgba(0, 0, 0, 0.13);
|
|
114
|
-
border: 1px solid rgba(255, 255 ,255, 0.53);
|
|
115
|
-
box-shadow: 0 0 50px rgba(0, 0, 0, 0.8);
|
|
116
|
-
backdrop-filter: blur(10px);
|
|
117
|
-
border-radius: 60px;
|
|
118
|
-
overflow: clip;
|
|
119
|
-
|
|
120
|
-
padding: 10px;
|
|
121
|
-
padding-left: 15px;
|
|
122
|
-
padding-right: 15px;
|
|
123
|
-
|
|
124
|
-
display: flex;
|
|
125
|
-
justify-content: center /* <-[x] */;
|
|
126
|
-
align-items: center /* <-[y] */;
|
|
127
|
-
`)
|
|
128
|
-
.split('\n')
|
|
129
|
-
.join(''),
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export const NEXT_PUBLIC_DEBUG = config.get('NEXT_PUBLIC_DEBUG').boolean().value;
|
|
134
|
-
|
|
135
|
-
export const NEXT_PUBLIC_OUR_DOMAINS = config.get('NEXT_PUBLIC_OUR_DOMAINS').list().required().value;
|
|
136
|
-
|
|
137
|
-
// TODO: !!!!!!!!!!! Make this more semantic, use named apps
|
|
138
|
-
export const PROMPTBOOK_STUDIO_APP_ID: string_app_id = '00fe1297-bbbe-4447-a321-cb7a1e010025';
|
|
139
|
-
export const RUKA_APP_ID: string_app_id = validateUserId('ccc3d0d7-2e28-4e12-9244-82440445c1fb');
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* You can login to theese apps with your email and password using BRJAPP
|
|
143
|
-
*/
|
|
144
|
-
export const SUPPORTED_APPS_FOR_USER_LOGIN = [PROMPTBOOK_STUDIO_APP_ID, RUKA_APP_ID, CLI_APP_ID];
|
|
145
|
-
|
|
146
|
-
// TODO: [feature/brj-app] !!! Change to SHA256 hash user ids
|
|
147
|
-
export const SYSTEM_USER_ID = validateUserId('000d2940-4a35-4859-83a8-3c754ea5df51');
|
|
148
|
-
export const ANONYMOUS_USER_ID = validateUserId('6bbb20dc-cb55-4f19-b867-71ad263bb828');
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Salt for hashing emails to derive user IDs
|
|
152
|
-
*/
|
|
153
|
-
export const USER_ID_HASH_SALT = config.get('USER_ID_HASH_SALT').value;
|
|
154
|
-
|
|
155
|
-
export const ZERO_UUID = validateUuid('00000000-0000-0000-0000-000000000000');
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* The number of pregenerated photobank images to offer to the user to choose from
|
|
159
|
-
*/
|
|
160
|
-
export const PHOTOBANK_SEARCH_IMAGES_COUNT = 4;
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Number of keywords reduction attempts until photobank give up and just pick random images
|
|
164
|
-
*/
|
|
165
|
-
export const OPTIMIZE_PHOTOBANK_MAX_SEARCH_DEPTH = 5;
|
|
166
|
-
|
|
167
|
-
export const NEXT_PUBLIC_SUPABASE_URL = config.get('NEXT_PUBLIC_SUPABASE_URL').url().required().value;
|
|
168
|
-
export const NEXT_PUBLIC_SUPABASE_ANON_KEY = config.get('NEXT_PUBLIC_SUPABASE_ANON_KEY').required().value;
|
|
169
|
-
export const SUPABASE_SERVICE_ROLE_KEY = config.get('SUPABASE_SERVICE_ROLE_KEY').value;
|
|
170
|
-
|
|
171
|
-
export const VERCEL_GIT_COMMIT_MESSAGE = config.get('VERCEL_GIT_COMMIT_MESSAGE').value;
|
|
172
|
-
export const VERCEL_GIT_COMMIT_SHA = config.get('VERCEL_GIT_COMMIT_SHA').value;
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* @deprecated Use App instead
|
|
176
|
-
*/
|
|
177
|
-
export const OPENAI_API_KEY = config.get('OPENAI_API_KEY').value;
|
|
178
|
-
|
|
179
|
-
export const ELEVENLABS_API_KEY =
|
|
180
|
-
config.get('ELEVENLABS_API_KEY').value || 'sk_895d7dc576352e55f6b81545951c711f0d55f66a3e015db7'; // <- TODO: [🟢] Remove this hardcoded api key
|
|
181
|
-
|
|
182
|
-
export const SENDGRID_API_KEY = config.get('SENDGRID_API_KEY').value;
|
|
183
|
-
export const ZEPTOMAIL_API_KEY = config.get('ZEPTOMAIL_API_KEY').value;
|
|
184
|
-
|
|
185
|
-
export const AZURE_COMPUTER_VISION_ENDPOINT = config.get('AZURE_COMPUTER_VISION_ENDPOINT').url().value;
|
|
186
|
-
export const AZURE_COMPUTER_VISION_KEY = config.get('AZURE_COMPUTER_VISION_KEY').value;
|
|
187
|
-
|
|
188
|
-
// TODO: [🧠] How to do required only on server
|
|
189
|
-
export const CDN_BUCKET = config.get('CDN_BUCKET') /*.required([📐])*/.value;
|
|
190
|
-
export const NEXT_PUBLIC_CDN_PATH_PREFIX = config.get('NEXT_PUBLIC_CDN_PATH_PREFIX') /*.required([📐])*/.value;
|
|
191
|
-
export const CDN_ENDPOINT = config.get('CDN_ENDPOINT') /*.required([📐])*/.value;
|
|
192
|
-
export const CDN_ACCESS_KEY_ID = config.get('CDN_ACCESS_KEY_ID') /*.required([📐])*/.value;
|
|
193
|
-
export const CDN_SECRET_ACCESS_KEY = config.get('CDN_SECRET_ACCESS_KEY') /*.required([📐])*/.value;
|
|
194
|
-
export const NEXT_PUBLIC_CDN_PUBLIC_URL = config.get('NEXT_PUBLIC_CDN_PUBLIC_URL').url() /*.required([📐])*/.value;
|
|
195
|
-
|
|
196
|
-
export const CDN = (CDN_BUCKET &&
|
|
197
|
-
// [📐]
|
|
198
|
-
new DigitalOceanSpaces({
|
|
199
|
-
bucket: CDN_BUCKET!,
|
|
200
|
-
pathPrefix: NEXT_PUBLIC_CDN_PATH_PREFIX!,
|
|
201
|
-
endpoint: CDN_ENDPOINT!,
|
|
202
|
-
accessKeyId: CDN_ACCESS_KEY_ID!,
|
|
203
|
-
secretAccessKey: CDN_SECRET_ACCESS_KEY!,
|
|
204
|
-
cdnPublicUrl: NEXT_PUBLIC_CDN_PUBLIC_URL!,
|
|
205
|
-
gzip: false /* <- TODO: Maybe just remove this functionality from WebGPT repository */,
|
|
206
|
-
})) as DigitalOceanSpaces;
|
|
207
|
-
|
|
208
|
-
export const MIDJOURNEY_WHOLE_GALLERY_PATH = 'X:/Mythings/MidJourney';
|
|
209
|
-
|
|
210
|
-
export const PDFMK_URL = config.get('PDFMK_URL', `@see https://github.com/hejny/pdfmk-server`).url().value;
|
|
211
|
-
export const PDFMK_TOKEN = config.get('PDFMK_TOKEN', `@see https://github.com/hejny/pdfmk-server`).value;
|
|
212
|
-
|
|
213
|
-
export const BRJAPP_API_KEY = config.get('BRJAPP_API_KEY').value;
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Options for the BrjappConnector instance
|
|
217
|
-
*/
|
|
218
|
-
export const BRJAPP_OPTIONS: BrjappOptions = {
|
|
219
|
-
userGroups: ['cli'],
|
|
220
|
-
initialCredits: 500000,
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
export const CITATION_COLORS = [
|
|
224
|
-
'#8a3ffc', // <- purple
|
|
225
|
-
'#0f62fe', // <- blue
|
|
226
|
-
'#42be65', // <- green
|
|
227
|
-
'#ff832b', // <- orange
|
|
228
|
-
'#ee5396', // <- pink
|
|
229
|
-
'#f1c21b', // <- yellow
|
|
230
|
-
'#007d79', // <- teal
|
|
231
|
-
'#fa4d56', // <- red
|
|
232
|
-
'#6fdc8c', // <- light green
|
|
233
|
-
'#be95ff', // <- lavender
|
|
234
|
-
];
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* Storage key for custom agents in localStorage
|
|
238
|
-
*/
|
|
239
|
-
export const CUSTOM_AGENTS_STORAGE_KEY = 'custom-agents';
|
|
240
|
-
|
|
241
|
-
/**
|
|
242
|
-
* Default agent name for AI avatars
|
|
243
|
-
*/
|
|
244
|
-
export const DEFAULT_AGENT_NAME = 'AI Avatar';
|
|
245
|
-
|
|
246
|
-
export function getTagedDefaultAgentName(tag: `[${string | string_char_emoji}]`): string {
|
|
247
|
-
console.trace(`${tag} getTagedDefaultAgentName called`);
|
|
248
|
-
return `${DEFAULT_AGENT_NAME} ${tag}`;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
/**
|
|
252
|
-
* Initial agent source for new agents
|
|
253
|
-
*/
|
|
254
|
-
export const INITIAL_AGENT_SOURCE = validateAgentSource(
|
|
255
|
-
spaceTrim(`
|
|
256
|
-
${DEFAULT_AGENT_NAME}
|
|
257
|
-
|
|
258
|
-
PERSONA A friendly AI assistant that helps you with your tasks
|
|
259
|
-
|
|
260
|
-
`),
|
|
261
|
-
);
|
|
262
|
-
|
|
263
|
-
// Auth services configurations:
|
|
264
|
-
export const NEXT_PUBLIC_FACEBOOK_APP_ID = config.get('NEXT_PUBLIC_FACEBOOK_APP_ID').value;
|
|
265
|
-
export const FACEBOOK_APP_SECRET = config.get('FACEBOOK_APP_SECRET').value;
|
|
266
|
-
export const NEXT_PUBLIC_LINKEDIN_CLIENT_ID = config.get('NEXT_PUBLIC_LINKEDIN_CLIENT_ID').value;
|
|
267
|
-
export const LINKEDIN_CLIENT_SECRET = config.get('LINKEDIN_CLIENT_SECRET').value;
|
|
268
|
-
export const NEXT_PUBLIC_GITHUB_CLIENT_ID = config.get('NEXT_PUBLIC_GITHUB_CLIENT_ID').value;
|
|
269
|
-
export const GITHUB_CLIENT_SECRET = config.get('GITHUB_CLIENT_SECRET').value;
|
|
270
|
-
export const NEXT_PUBLIC_GOOGLE_CLIENT_ID = config.get('NEXT_PUBLIC_GOOGLE_CLIENT_ID').value;
|
|
271
|
-
export const GOOGLE_CLIENT_SECRET = config.get('GOOGLE_CLIENT_SECRET').value;
|
|
272
|
-
|
|
273
|
-
// Apify configuration for social media scraping
|
|
274
|
-
export const APIFY_API_KEY = config.get('APIFY_API_KEY').value;
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Boilerplate discussion topics for the Arena
|
|
278
|
-
*/
|
|
279
|
-
export const ARENA_DISCUSSION_TOPICS = [
|
|
280
|
-
'What is the future of AI?',
|
|
281
|
-
'How can AI improve education?',
|
|
282
|
-
'What are the ethical implications of AI?',
|
|
283
|
-
'Will AI replace human jobs or create new ones?',
|
|
284
|
-
'How should AI be regulated?',
|
|
285
|
-
'What role will AI play in healthcare?',
|
|
286
|
-
'Can AI be creative and artistic?',
|
|
287
|
-
'How will AI change the way we work?',
|
|
288
|
-
'What are the risks of artificial general intelligence?',
|
|
289
|
-
'How can we ensure AI remains beneficial to humanity?',
|
|
290
|
-
'Should AI have rights?',
|
|
291
|
-
'How will AI impact privacy and surveillance?',
|
|
292
|
-
'What is the role of AI in scientific discovery?',
|
|
293
|
-
'How can AI help solve climate change?',
|
|
294
|
-
'What are the philosophical implications of conscious AI?',
|
|
295
|
-
|
|
296
|
-
// More conversational and diverse topics
|
|
297
|
-
'Is remote work better than office work?',
|
|
298
|
-
'Should social media be regulated more heavily?',
|
|
299
|
-
'What makes a good leader in 2025?',
|
|
300
|
-
'Is cryptocurrency the future of money?',
|
|
301
|
-
'How important is work-life balance?',
|
|
302
|
-
'Should everyone learn to code?',
|
|
303
|
-
"What's the best way to combat misinformation?",
|
|
304
|
-
'Is space exploration worth the investment?',
|
|
305
|
-
'How do we fix the housing crisis?',
|
|
306
|
-
"What's the ideal length for a work week?",
|
|
307
|
-
'Should university education be free?',
|
|
308
|
-
'How do we address mental health at work?',
|
|
309
|
-
'Is nuclear energy the solution to climate change?',
|
|
310
|
-
'What makes content go viral?',
|
|
311
|
-
'How should we prepare for the next pandemic?',
|
|
312
|
-
];
|
|
@@ -26,7 +26,7 @@ export async function GET(request: Request, { params }: { params: Promise<{ agen
|
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
const response = await agent.callChatModel!({
|
|
29
|
-
title: `Chat with agent ${agentName}`,
|
|
29
|
+
title: `Chat with agent ${agentName /* <- TODO: [🕛] There should be `agentFullname` not `agentName` */}`,
|
|
30
30
|
parameters: {},
|
|
31
31
|
modelRequirements: {
|
|
32
32
|
modelVariant: 'CHAT',
|
|
@@ -60,3 +60,9 @@ export async function GET(request: Request, { params }: { params: Promise<{ agen
|
|
|
60
60
|
);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* TODO: !!!!!! Record conversations to `ChatHistory`
|
|
67
|
+
* TODO: !!!!!! Make api endpoint for feedback on agent responses `/apps/agents-server/src/app/agents/[agentName]/api/feedback/route.ts` and record to `ChatFeedback`
|
|
68
|
+
*/
|
|
@@ -18,7 +18,7 @@ export function BookEditorWrapper({ agentName, initialAgentSource }: BookEditorW
|
|
|
18
18
|
// Debounce timer ref so we can clear previous pending save
|
|
19
19
|
const debounceTimerRef = useRef<number | null>(null);
|
|
20
20
|
// Configurable debounce delay (ms) - tweak if needed
|
|
21
|
-
const DEBOUNCE_DELAY =
|
|
21
|
+
const DEBOUNCE_DELAY = 1000;
|
|
22
22
|
|
|
23
23
|
const performSave = async (sourceToSave: string_book) => {
|
|
24
24
|
setSaveStatus('saving');
|
|
@@ -88,6 +88,7 @@ export function BookEditorWrapper({ agentName, initialAgentSource }: BookEditorW
|
|
|
88
88
|
|
|
89
89
|
<BookEditor
|
|
90
90
|
className="w-full h-full"
|
|
91
|
+
isBorderRadiusDisabled
|
|
91
92
|
height={null}
|
|
92
93
|
value={agentSource}
|
|
93
94
|
onChange={handleChange}
|
|
@@ -136,5 +137,4 @@ export function BookEditorWrapper({ agentName, initialAgentSource }: BookEditorW
|
|
|
136
137
|
* DONE: Implement debouncing for auto-save (600ms delay) ✅
|
|
137
138
|
* TODO: !!! Add error handling and retry logic
|
|
138
139
|
* TODO: !!! Show save status indicator
|
|
139
|
-
* TODO: !!!!! Add file upload capability
|
|
140
140
|
*/
|
package/apps/agents-server/src/app/agents/[agentName]/book+chat/AgentBookAndChatComponent.tsx
CHANGED
|
@@ -84,8 +84,6 @@ export function AgentBookAndChatComponent() {
|
|
|
84
84
|
return agent;
|
|
85
85
|
}, [agentSource, setAgentSource, apiKey]);
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
87
|
return (
|
|
90
88
|
<div className="min-h-screen relative">
|
|
91
89
|
{/* Floating API Key Configuration */}
|
|
@@ -139,17 +137,17 @@ export function AgentBookAndChatComponent() {
|
|
|
139
137
|
<ResizablePanelsAuto name="two-editors">
|
|
140
138
|
<BookEditor
|
|
141
139
|
className="w-full h-full"
|
|
140
|
+
isBorderRadiusDisabled
|
|
142
141
|
height={null}
|
|
143
142
|
value={agentSource}
|
|
144
143
|
onChange={setAgentSource}
|
|
145
144
|
// className={styles.BookEditor}
|
|
146
145
|
isVerbose={false}
|
|
147
|
-
isBorderRadiusDisabled
|
|
148
146
|
onFileUpload={(file) => {
|
|
149
147
|
return file.name;
|
|
150
148
|
}}
|
|
151
149
|
/>
|
|
152
|
-
|
|
150
|
+
|
|
153
151
|
<AgentChat className={`h-full flex flex-col`} {...{ agent }} />
|
|
154
152
|
</ResizablePanelsAuto>
|
|
155
153
|
</div>
|
|
@@ -127,14 +127,14 @@ export default async function AgentPage({ params }: { params: Promise<{ agentNam
|
|
|
127
127
|
<div className="flex gap-4 mt-6">
|
|
128
128
|
<a
|
|
129
129
|
href={`${pageUrl}/chat`}
|
|
130
|
-
// <-
|
|
130
|
+
// <- TODO: [🧠] Can I append path like this on current browser URL in href?
|
|
131
131
|
className="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded shadow font-semibold transition"
|
|
132
132
|
>
|
|
133
133
|
💬 Chat
|
|
134
134
|
</a>
|
|
135
135
|
<a
|
|
136
136
|
href={`${pageUrl}/book`}
|
|
137
|
-
// <-
|
|
137
|
+
// <- TODO: [🧠] Can I append path like this on current browser URL in href?
|
|
138
138
|
className="bg-gray-200 hover:bg-gray-300 text-gray-800 px-4 py-2 rounded shadow font-semibold transition"
|
|
139
139
|
>
|
|
140
140
|
✏️ Edit Agent Book
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { AgentsDatabaseSchema } from '@promptbook-local/types';
|
|
2
2
|
import { $isRunningInBrowser, $isRunningInNode, $isRunningInWebWorker } from '@promptbook-local/utils';
|
|
3
3
|
import type { SupabaseClient } from '@supabase/supabase-js';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { $provideSupabaseForBrowser } from './$provideSupabaseForBrowser';
|
|
5
|
+
import { $provideSupabaseForServer } from './$provideSupabaseForServer';
|
|
6
|
+
import { $provideSupabaseForWorker } from './$provideSupabaseForWorker';
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* Get supabase client in any environment
|
|
@@ -12,14 +12,18 @@ import { getSupabaseForWorker } from './getSupabaseForWorker';
|
|
|
12
12
|
*
|
|
13
13
|
* @returns instance of supabase client
|
|
14
14
|
*/
|
|
15
|
-
export function
|
|
15
|
+
export function $provideSupabase(): SupabaseClient<AgentsDatabaseSchema> {
|
|
16
16
|
if ($isRunningInNode()) {
|
|
17
|
-
return
|
|
17
|
+
return $provideSupabaseForServer();
|
|
18
18
|
} else if ($isRunningInBrowser()) {
|
|
19
|
-
return
|
|
19
|
+
return $provideSupabaseForBrowser();
|
|
20
20
|
} else if ($isRunningInWebWorker()) {
|
|
21
|
-
return
|
|
21
|
+
return $provideSupabaseForWorker();
|
|
22
22
|
} else {
|
|
23
23
|
throw new Error('Unknown environment, cannot determine how to get Supabase client');
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Note: [🎇] Promptbook Agents Server is not using Supabase in Browser so maybe remove this file
|
|
29
|
+
*/
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { createClient, SupabaseClient } from '@supabase/supabase-js';
|
|
2
1
|
import { AgentsDatabaseSchema } from '@promptbook-local/types';
|
|
3
2
|
import { $isRunningInBrowser } from '@promptbook-local/utils';
|
|
3
|
+
import { createClient, SupabaseClient } from '@supabase/supabase-js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Internal cache for `
|
|
6
|
+
* Internal cache for `$provideSupabaseForBrowser`
|
|
7
7
|
*
|
|
8
8
|
* @private
|
|
9
9
|
* @singleton
|
|
@@ -14,14 +14,14 @@ let supabase: SupabaseClient<AgentsDatabaseSchema>;
|
|
|
14
14
|
* Get supabase client
|
|
15
15
|
*
|
|
16
16
|
* Note: The client is cached, so it's safe to call this function multiple times
|
|
17
|
-
* Note: This function is available ONLY in browser, use
|
|
17
|
+
* Note: This function is available ONLY in browser, use $provideSupabaseForServer in node
|
|
18
18
|
*
|
|
19
19
|
* @returns instance of supabase client
|
|
20
20
|
*/
|
|
21
|
-
export function
|
|
21
|
+
export function $provideSupabaseForBrowser(): typeof supabase {
|
|
22
22
|
if (!$isRunningInBrowser()) {
|
|
23
23
|
throw new Error(
|
|
24
|
-
'Function `
|
|
24
|
+
'Function `$provideSupabaseForBrowser` can not be used on server or worker, use `$provideSupabaseForServer` or `$provideSupabaseForWorker` instead.',
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -35,3 +35,7 @@ export function getSupabaseForBrowser(): typeof supabase {
|
|
|
35
35
|
|
|
36
36
|
return supabase;
|
|
37
37
|
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Note: [🎇] Promptbook Agents Server is not using Supabase in Browser so maybe remove this file
|
|
41
|
+
*/
|
|
@@ -3,7 +3,7 @@ import { $isRunningInNode } from '@promptbook-local/utils';
|
|
|
3
3
|
import { createClient, SupabaseClient } from '@supabase/supabase-js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Internal cache for `
|
|
6
|
+
* Internal cache for `$provideSupabaseForServer`
|
|
7
7
|
*
|
|
8
8
|
* @private
|
|
9
9
|
* @singleton
|
|
@@ -14,14 +14,14 @@ let supabase: SupabaseClient<AgentsDatabaseSchema>;
|
|
|
14
14
|
* Get supabase client
|
|
15
15
|
*
|
|
16
16
|
* Note: The client is cached, so it's safe to call this function multiple times
|
|
17
|
-
* Note: This function is available ONLY on server/node, use
|
|
17
|
+
* Note: This function is available ONLY on server/node, use $provideSupabaseForClient in browser
|
|
18
18
|
*
|
|
19
19
|
* @returns instance of supabase client
|
|
20
20
|
*/
|
|
21
|
-
export function
|
|
21
|
+
export function $provideSupabaseForServer(): typeof supabase {
|
|
22
22
|
if (!$isRunningInNode()) {
|
|
23
23
|
throw new Error(
|
|
24
|
-
'Function `
|
|
24
|
+
'Function `$provideSupabaseForServer` can not be used in browser, use `$provideSupabaseForBrowser` instead.',
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -3,7 +3,7 @@ import { $isRunningInWebWorker } from '@promptbook-local/utils';
|
|
|
3
3
|
import { createClient, SupabaseClient } from '@supabase/supabase-js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Internal cache for `
|
|
6
|
+
* Internal cache for `$provideSupabaseForWorker`
|
|
7
7
|
*
|
|
8
8
|
* @private
|
|
9
9
|
* @singleton
|
|
@@ -14,14 +14,14 @@ let supabase: SupabaseClient<AgentsDatabaseSchema>;
|
|
|
14
14
|
* Get supabase client
|
|
15
15
|
*
|
|
16
16
|
* Note: The client is cached, so it's safe to call this function multiple times
|
|
17
|
-
* Note: This function is available ONLY in worker, use
|
|
17
|
+
* Note: This function is available ONLY in worker, use $provideSupabaseForBrowser for main thread
|
|
18
18
|
*
|
|
19
19
|
* @returns instance of supabase client
|
|
20
20
|
*/
|
|
21
|
-
export function
|
|
21
|
+
export function $provideSupabaseForWorker(): typeof supabase {
|
|
22
22
|
if (!$isRunningInWebWorker) {
|
|
23
23
|
throw new Error(
|
|
24
|
-
'Function `
|
|
24
|
+
'Function `$provideSupabaseForWorker` can not be used in browser, use `$provideSupabaseForBrowser` instead.',
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -37,6 +37,7 @@ export function getSupabaseForWorker(): typeof supabase {
|
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
/**
|
|
40
|
+
* Note: [🎇] Promptbook Agents Server is not using Supabase in Browser so maybe remove this file
|
|
40
41
|
* TODO: Fix> No storage option exists to persist the session, which may result in unexpected behavior when using auth.
|
|
41
42
|
If you want to set persistSession to true, please provide a storage option or you may set persistSession to false to disable this warning.
|
|
42
43
|
*/
|