@promptbook/cli 0.104.0-6 → 0.104.0-7
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/src/app/agents/[agentName]/code/page.tsx +2 -1
- package/apps/agents-server/src/app/agents/[agentName]/images/default-avatar.png/getAgentDefaultAvatarPrompt.ts +31 -0
- package/apps/agents-server/src/app/agents/[agentName]/images/default-avatar.png/route.ts +53 -38
- package/apps/agents-server/src/app/agents/[agentName]/images/icon-256.png/route.tsx +2 -1
- package/apps/agents-server/src/app/agents/[agentName]/images/page.tsx +200 -0
- package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-fullhd.png/route.tsx +2 -1
- package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-phone.png/route.tsx +2 -1
- package/apps/agents-server/src/app/agents/[agentName]/integration/page.tsx +2 -1
- package/apps/agents-server/src/app/agents/[agentName]/links/page.tsx +2 -1
- package/apps/agents-server/src/app/agents/[agentName]/opengraph-image.tsx +5 -1
- package/apps/agents-server/src/app/agents/[agentName]/page.tsx +2 -1
- package/apps/agents-server/src/app/agents/[agentName]/system-message/page.tsx +2 -1
- package/apps/agents-server/src/components/AgentProfile/AgentProfile.tsx +2 -1
- package/apps/agents-server/src/components/Homepage/AgentCard.tsx +2 -1
- package/esm/index.es.js +8 -9
- package/esm/index.es.js.map +1 -1
- package/esm/typings/servers.d.ts +8 -0
- package/esm/typings/src/_packages/core.index.d.ts +2 -0
- package/esm/typings/src/_packages/types.index.d.ts +2 -0
- package/esm/typings/src/book-2.0/utils/generatePlaceholderAgentProfileImageUrl.d.ts +1 -1
- package/esm/typings/src/types/ModelRequirements.d.ts +38 -14
- package/esm/typings/src/types/typeAliases.d.ts +7 -1
- package/esm/typings/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +8 -9
- package/umd/index.umd.js.map +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { NEXT_PUBLIC_SITE_URL } from '@/config';
|
|
3
4
|
import Editor from '@monaco-editor/react';
|
|
4
5
|
import { generatePlaceholderAgentProfileImageUrl } from '@promptbook-local/core';
|
|
5
6
|
import { AgentBasicInformation } from '@promptbook-local/types';
|
|
@@ -121,7 +122,7 @@ export default function AgentCodePage({ params }: { params: Promise<{ agentName:
|
|
|
121
122
|
src={
|
|
122
123
|
agentProfile.meta.image ||
|
|
123
124
|
agentProfile.permanentId ||
|
|
124
|
-
generatePlaceholderAgentProfileImageUrl(agentName)
|
|
125
|
+
generatePlaceholderAgentProfileImageUrl(agentName, NEXT_PUBLIC_SITE_URL)
|
|
125
126
|
}
|
|
126
127
|
alt={agentProfile.meta.fullname || agentName}
|
|
127
128
|
className="w-16 h-16 rounded-full object-cover border-2 border-gray-200"
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { AgentBasicInformation } from '@promptbook-local/types';
|
|
2
|
+
import spaceTrim from 'spacetrim';
|
|
3
|
+
import { string_prompt_image } from '../../../../../../../../src/types/typeAliases';
|
|
4
|
+
|
|
5
|
+
export function getAgentDefaultAvatarPrompt(agent: AgentBasicInformation): string_prompt_image {
|
|
6
|
+
const {
|
|
7
|
+
agentName,
|
|
8
|
+
personaDescription,
|
|
9
|
+
meta: { fullname, color },
|
|
10
|
+
} = agent;
|
|
11
|
+
|
|
12
|
+
return spaceTrim(
|
|
13
|
+
(block) => `
|
|
14
|
+
Professional corporate headshot of ${fullname || agentName}
|
|
15
|
+
|
|
16
|
+
${block(personaDescription || '')}
|
|
17
|
+
|
|
18
|
+
- Professional business portrait photograph
|
|
19
|
+
- Photorealistic, studio quality lighting
|
|
20
|
+
- Shot with 85mm lens, shallow depth of field
|
|
21
|
+
- Neutral gray or soft gradient background
|
|
22
|
+
- Subject wearing professional attire with accent colors: ${color}
|
|
23
|
+
- Confident, approachable expression with slight smile
|
|
24
|
+
- Eye-level camera angle, centered composition
|
|
25
|
+
- Soft diffused lighting, subtle rim light
|
|
26
|
+
- Sharp focus on eyes, cinematic color grading
|
|
27
|
+
- 8K resolution, ultra detailed
|
|
28
|
+
|
|
29
|
+
`,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -4,12 +4,13 @@ import { $provideAgentCollectionForServer } from '@/src/tools/$provideAgentColle
|
|
|
4
4
|
import { $provideCdnForServer } from '@/src/tools/$provideCdnForServer';
|
|
5
5
|
import { $provideExecutionToolsForServer } from '@/src/tools/$provideExecutionToolsForServer';
|
|
6
6
|
import { parseAgentSource } from '@promptbook-local/core';
|
|
7
|
-
import { serializeError } from '@promptbook-local/utils';
|
|
7
|
+
import { computeHash, serializeError } from '@promptbook-local/utils';
|
|
8
8
|
import { NextRequest, NextResponse } from 'next/server';
|
|
9
9
|
import { assertsError } from '../../../../../../../../src/errors/assertsError';
|
|
10
|
-
import { getSingleLlmExecutionTools } from '../../../../../../../../src/llm-providers/_multiple/getSingleLlmExecutionTools';
|
|
11
10
|
import type { LlmExecutionTools } from '../../../../../../../../src/execution/LlmExecutionTools';
|
|
11
|
+
import { getSingleLlmExecutionTools } from '../../../../../../../../src/llm-providers/_multiple/getSingleLlmExecutionTools';
|
|
12
12
|
import type { string_url } from '../../../../../../../../src/types/typeAliases';
|
|
13
|
+
import { getAgentDefaultAvatarPrompt } from './getAgentDefaultAvatarPrompt';
|
|
13
14
|
|
|
14
15
|
export async function GET(request: NextRequest, { params }: { params: Promise<{ agentName: string }> }) {
|
|
15
16
|
try {
|
|
@@ -20,13 +21,28 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
|
|
|
20
21
|
return NextResponse.json({ error: 'Agent name is required' }, { status: 400 });
|
|
21
22
|
}
|
|
22
23
|
|
|
23
|
-
//
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
// 1. Fetch agent data first to construct the prompt
|
|
25
|
+
const collection = await $provideAgentCollectionForServer();
|
|
26
|
+
let agentSource;
|
|
27
|
+
try {
|
|
28
|
+
agentSource = await collection.getAgentSource(agentName);
|
|
29
|
+
} catch (error) {
|
|
30
|
+
// If agent not found, redirect to pravatar with the agent name as unique identifier
|
|
31
|
+
const pravaratUrl = `https://i.pravatar.cc/1024?u=${encodeURIComponent(agentName)}`;
|
|
32
|
+
return NextResponse.redirect(pravaratUrl);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const agentProfile = parseAgentSource(agentSource);
|
|
36
|
+
|
|
37
|
+
const prompt = getAgentDefaultAvatarPrompt(agentProfile);
|
|
38
|
+
|
|
39
|
+
// Use hash of the prompt as cache key - this ensures regeneration when prompt changes
|
|
40
|
+
const promptHash = computeHash(prompt);
|
|
41
|
+
const internalFilename = `agent-avatar-${promptHash}.png`;
|
|
26
42
|
|
|
27
43
|
const supabase = $provideSupabaseForServer();
|
|
28
44
|
|
|
29
|
-
// Check if image already exists in database
|
|
45
|
+
// Check if image with this prompt hash already exists in database
|
|
30
46
|
const { data: existingImage, error: selectError } = await supabase
|
|
31
47
|
.from(await $getTableName(`Image`))
|
|
32
48
|
.select('cdnUrl')
|
|
@@ -39,35 +55,23 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
|
|
|
39
55
|
}
|
|
40
56
|
|
|
41
57
|
if (existingImage) {
|
|
42
|
-
// Image exists,
|
|
43
|
-
|
|
58
|
+
// Image exists, fetch from CDN and return directly
|
|
59
|
+
const imageResponse = await fetch(existingImage.cdnUrl as string_url);
|
|
60
|
+
if (!imageResponse.ok) {
|
|
61
|
+
throw new Error(`Failed to fetch image from CDN: ${imageResponse.status}`);
|
|
62
|
+
}
|
|
63
|
+
const imageBuffer = await imageResponse.arrayBuffer();
|
|
64
|
+
return new NextResponse(imageBuffer, {
|
|
65
|
+
status: 200,
|
|
66
|
+
headers: {
|
|
67
|
+
'Content-Type': 'image/png',
|
|
68
|
+
'Cache-Control': 'public, max-age=31536000, immutable',
|
|
69
|
+
},
|
|
70
|
+
});
|
|
44
71
|
}
|
|
45
72
|
|
|
46
73
|
// Image doesn't exist, generate it
|
|
47
74
|
|
|
48
|
-
// 1. Fetch agent data
|
|
49
|
-
const collection = await $provideAgentCollectionForServer();
|
|
50
|
-
let agentSource;
|
|
51
|
-
try {
|
|
52
|
-
agentSource = await collection.getAgentSource(agentName);
|
|
53
|
-
} catch (error) {
|
|
54
|
-
// If agent not found, return 404 or default generic image?
|
|
55
|
-
// User said: "Use the ... instead of Gravatar for agents that do not have custom uploaded avatar"
|
|
56
|
-
// If agent doesn't exist, we probably can't generate a specific avatar.
|
|
57
|
-
return NextResponse.json({ error: 'Agent not found' }, { status: 404 });
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
const agentProfile = parseAgentSource(agentSource);
|
|
61
|
-
|
|
62
|
-
// Extract required fields
|
|
63
|
-
const name = agentProfile.meta?.title || agentProfile.agentName || agentName;
|
|
64
|
-
const persona = agentProfile.personaDescription || 'an AI agent';
|
|
65
|
-
const color = agentProfile.meta?.color || 'blue';
|
|
66
|
-
|
|
67
|
-
// Construct prompt
|
|
68
|
-
// "Image of {agent.name}, {agent.persona}, portrait, use color ${agent.meta.color}, detailed, high quality"
|
|
69
|
-
const prompt = `Image of ${name}, ${persona}, portrait, use color ${color}, detailed, high quality`;
|
|
70
|
-
|
|
71
75
|
// 2. Generate image
|
|
72
76
|
const executionTools = await $provideExecutionToolsForServer();
|
|
73
77
|
const llmTools = getSingleLlmExecutionTools(executionTools.llm) as LlmExecutionTools;
|
|
@@ -79,12 +83,13 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
|
|
|
79
83
|
const imageResult = await llmTools.callImageGenerationModel({
|
|
80
84
|
title: `Generate default avatar for ${agentName}`,
|
|
81
85
|
content: prompt,
|
|
82
|
-
parameters: {
|
|
83
|
-
size: '1024x1792', // Vertical orientation
|
|
84
|
-
},
|
|
86
|
+
parameters: {},
|
|
85
87
|
modelRequirements: {
|
|
86
88
|
modelVariant: 'IMAGE_GENERATION',
|
|
87
|
-
modelName: 'dall-e-3',
|
|
89
|
+
modelName: 'dall-e-3',
|
|
90
|
+
size: '1024x1792', // <- Vertical orientation
|
|
91
|
+
quality: 'hd',
|
|
92
|
+
style: 'natural',
|
|
88
93
|
},
|
|
89
94
|
});
|
|
90
95
|
|
|
@@ -125,9 +130,19 @@ export async function GET(request: NextRequest, { params }: { params: Promise<{
|
|
|
125
130
|
throw insertError;
|
|
126
131
|
}
|
|
127
132
|
|
|
128
|
-
//
|
|
129
|
-
|
|
130
|
-
|
|
133
|
+
// Return the newly created image directly
|
|
134
|
+
const finalImageResponse = await fetch(cdnUrl.href);
|
|
135
|
+
if (!finalImageResponse.ok) {
|
|
136
|
+
throw new Error(`Failed to fetch newly created image from CDN: ${finalImageResponse.status}`);
|
|
137
|
+
}
|
|
138
|
+
const finalImageBuffer = await finalImageResponse.arrayBuffer();
|
|
139
|
+
return new NextResponse(finalImageBuffer, {
|
|
140
|
+
status: 200,
|
|
141
|
+
headers: {
|
|
142
|
+
'Content-Type': 'image/png',
|
|
143
|
+
'Cache-Control': 'public, max-age=31536000, immutable',
|
|
144
|
+
},
|
|
145
|
+
});
|
|
131
146
|
} catch (error) {
|
|
132
147
|
assertsError(error);
|
|
133
148
|
console.error('Error serving default avatar:', error);
|
|
@@ -5,6 +5,7 @@ import { assertsError } from '../../../../../../../../src/errors/assertsError';
|
|
|
5
5
|
import { Color } from '../../../../../../../../src/utils/color/Color';
|
|
6
6
|
import { keepUnused } from '../../../../../../../../src/utils/organization/keepUnused';
|
|
7
7
|
import { getAgentName, getAgentProfile } from '../../_utils';
|
|
8
|
+
import { NEXT_PUBLIC_SITE_URL } from '@/config';
|
|
8
9
|
|
|
9
10
|
const size = {
|
|
10
11
|
width: 256,
|
|
@@ -46,7 +47,7 @@ export async function GET(request: Request, { params }: { params: Promise<{ agen
|
|
|
46
47
|
{/* Note: `next/image` is not working propperly with `next/og` */}
|
|
47
48
|
{/* eslint-disable-next-line @next/next/no-img-element */}
|
|
48
49
|
<img
|
|
49
|
-
src={agentProfile.meta.image || agentProfile.permanentId ||generatePlaceholderAgentProfileImageUrl(agentName)}
|
|
50
|
+
src={agentProfile.meta.image || agentProfile.permanentId ||generatePlaceholderAgentProfileImageUrl(agentName, NEXT_PUBLIC_SITE_URL)}
|
|
50
51
|
alt="Agent Icon"
|
|
51
52
|
/>
|
|
52
53
|
</div>
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
'use server';
|
|
2
|
+
|
|
3
|
+
import { saturate } from '@promptbook-local/color';
|
|
4
|
+
import { PROMPTBOOK_COLOR } from '@promptbook-local/core';
|
|
5
|
+
import Link from 'next/link';
|
|
6
|
+
import { Color } from '../../../../../../../src/utils/color/Color';
|
|
7
|
+
import { getAgentName, getAgentProfile } from '../_utils';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Available image types for agents with their descriptions and sizes
|
|
11
|
+
*/
|
|
12
|
+
const AGENT_IMAGES = [
|
|
13
|
+
{
|
|
14
|
+
name: 'default-avatar.png',
|
|
15
|
+
title: 'Default Avatar',
|
|
16
|
+
description: 'AI-generated avatar image based on the agent profile. Vertical orientation (1024x1792).',
|
|
17
|
+
size: '1024×1792',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: 'icon-256.png',
|
|
21
|
+
title: 'Icon (256×256)',
|
|
22
|
+
description: 'Small circular icon suitable for profile pictures and thumbnails.',
|
|
23
|
+
size: '256×256',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'screenshot-fullhd.png',
|
|
27
|
+
title: 'Screenshot Full HD',
|
|
28
|
+
description: 'Landscape screenshot showing the agent with name. Suitable for desktop previews.',
|
|
29
|
+
size: '1920×1080',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'screenshot-phone.png',
|
|
33
|
+
title: 'Screenshot Phone',
|
|
34
|
+
description: 'Portrait screenshot optimized for mobile devices.',
|
|
35
|
+
size: '1080×1920',
|
|
36
|
+
},
|
|
37
|
+
] as const;
|
|
38
|
+
|
|
39
|
+
export default async function AgentImagesPage({ params }: { params: Promise<{ agentName: string }> }) {
|
|
40
|
+
const agentName = await getAgentName(params);
|
|
41
|
+
const agentProfile = await getAgentProfile(agentName);
|
|
42
|
+
|
|
43
|
+
const brandColor = Color.fromSafe(agentProfile.meta.color || PROMPTBOOK_COLOR);
|
|
44
|
+
const brandColorHex = brandColor.then(saturate(-0.5)).toHex();
|
|
45
|
+
|
|
46
|
+
const fullname = (agentProfile.meta.fullname || agentProfile.agentName || 'Agent') as string;
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
style={{
|
|
51
|
+
minHeight: '100vh',
|
|
52
|
+
backgroundColor: '#f5f5f5',
|
|
53
|
+
padding: '2rem',
|
|
54
|
+
}}
|
|
55
|
+
>
|
|
56
|
+
<div
|
|
57
|
+
style={{
|
|
58
|
+
maxWidth: '1200px',
|
|
59
|
+
margin: '0 auto',
|
|
60
|
+
}}
|
|
61
|
+
>
|
|
62
|
+
<header
|
|
63
|
+
style={{
|
|
64
|
+
marginBottom: '2rem',
|
|
65
|
+
padding: '1.5rem',
|
|
66
|
+
backgroundColor: brandColorHex,
|
|
67
|
+
borderRadius: '12px',
|
|
68
|
+
color: 'white',
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<h1 style={{ margin: 0, fontSize: '2rem' }}>
|
|
72
|
+
Images for <strong>{fullname}</strong>
|
|
73
|
+
</h1>
|
|
74
|
+
<p style={{ margin: '0.5rem 0 0', opacity: 0.9 }}>
|
|
75
|
+
All available image assets for agent{' '}
|
|
76
|
+
<code
|
|
77
|
+
style={{
|
|
78
|
+
backgroundColor: 'rgba(255,255,255,0.2)',
|
|
79
|
+
padding: '2px 6px',
|
|
80
|
+
borderRadius: '4px',
|
|
81
|
+
}}
|
|
82
|
+
>
|
|
83
|
+
{agentName}
|
|
84
|
+
</code>
|
|
85
|
+
</p>
|
|
86
|
+
</header>
|
|
87
|
+
|
|
88
|
+
<div
|
|
89
|
+
style={{
|
|
90
|
+
display: 'grid',
|
|
91
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(300px, 1fr))',
|
|
92
|
+
gap: '1.5rem',
|
|
93
|
+
}}
|
|
94
|
+
>
|
|
95
|
+
{AGENT_IMAGES.map((image) => {
|
|
96
|
+
const imageUrl = `/agents/${encodeURIComponent(agentName)}/images/${image.name}`;
|
|
97
|
+
return (
|
|
98
|
+
<div
|
|
99
|
+
key={image.name}
|
|
100
|
+
style={{
|
|
101
|
+
backgroundColor: 'white',
|
|
102
|
+
borderRadius: '12px',
|
|
103
|
+
overflow: 'hidden',
|
|
104
|
+
boxShadow: '0 2px 8px rgba(0,0,0,0.1)',
|
|
105
|
+
}}
|
|
106
|
+
>
|
|
107
|
+
<div
|
|
108
|
+
style={{
|
|
109
|
+
aspectRatio: '16/9',
|
|
110
|
+
backgroundColor: '#e0e0e0',
|
|
111
|
+
display: 'flex',
|
|
112
|
+
alignItems: 'center',
|
|
113
|
+
justifyContent: 'center',
|
|
114
|
+
overflow: 'hidden',
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
{/* eslint-disable-next-line @next/next/no-img-element */}
|
|
118
|
+
<img
|
|
119
|
+
src={imageUrl}
|
|
120
|
+
alt={image.title}
|
|
121
|
+
style={{
|
|
122
|
+
maxWidth: '100%',
|
|
123
|
+
maxHeight: '100%',
|
|
124
|
+
objectFit: 'contain',
|
|
125
|
+
}}
|
|
126
|
+
/>
|
|
127
|
+
</div>
|
|
128
|
+
<div style={{ padding: '1rem' }}>
|
|
129
|
+
<h2 style={{ margin: '0 0 0.5rem', fontSize: '1.25rem' }}>{image.title}</h2>
|
|
130
|
+
<p style={{ margin: '0 0 0.5rem', color: '#666', fontSize: '0.9rem' }}>
|
|
131
|
+
{image.description}
|
|
132
|
+
</p>
|
|
133
|
+
<div
|
|
134
|
+
style={{
|
|
135
|
+
display: 'flex',
|
|
136
|
+
justifyContent: 'space-between',
|
|
137
|
+
alignItems: 'center',
|
|
138
|
+
marginTop: '1rem',
|
|
139
|
+
}}
|
|
140
|
+
>
|
|
141
|
+
<span
|
|
142
|
+
style={{
|
|
143
|
+
backgroundColor: '#f0f0f0',
|
|
144
|
+
padding: '4px 8px',
|
|
145
|
+
borderRadius: '4px',
|
|
146
|
+
fontSize: '0.85rem',
|
|
147
|
+
color: '#555',
|
|
148
|
+
}}
|
|
149
|
+
>
|
|
150
|
+
{image.size}
|
|
151
|
+
</span>
|
|
152
|
+
<Link
|
|
153
|
+
href={imageUrl}
|
|
154
|
+
target="_blank"
|
|
155
|
+
style={{
|
|
156
|
+
backgroundColor: brandColorHex,
|
|
157
|
+
color: 'white',
|
|
158
|
+
padding: '8px 16px',
|
|
159
|
+
borderRadius: '6px',
|
|
160
|
+
textDecoration: 'none',
|
|
161
|
+
fontSize: '0.9rem',
|
|
162
|
+
}}
|
|
163
|
+
>
|
|
164
|
+
Open Image
|
|
165
|
+
</Link>
|
|
166
|
+
</div>
|
|
167
|
+
</div>
|
|
168
|
+
</div>
|
|
169
|
+
);
|
|
170
|
+
})}
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
<footer
|
|
174
|
+
style={{
|
|
175
|
+
marginTop: '2rem',
|
|
176
|
+
padding: '1rem',
|
|
177
|
+
backgroundColor: 'white',
|
|
178
|
+
borderRadius: '12px',
|
|
179
|
+
textAlign: 'center',
|
|
180
|
+
color: '#666',
|
|
181
|
+
}}
|
|
182
|
+
>
|
|
183
|
+
<p style={{ margin: 0 }}>
|
|
184
|
+
<Link
|
|
185
|
+
href={`/agents/${encodeURIComponent(agentName)}`}
|
|
186
|
+
style={{ color: brandColorHex, textDecoration: 'none' }}
|
|
187
|
+
>
|
|
188
|
+
← Back to {fullname}
|
|
189
|
+
</Link>
|
|
190
|
+
</p>
|
|
191
|
+
</footer>
|
|
192
|
+
</div>
|
|
193
|
+
</div>
|
|
194
|
+
);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* TODO: [🦚] Add download button functionality
|
|
199
|
+
* TODO: [🦚] Add image regeneration option for default-avatar
|
|
200
|
+
*/
|
package/apps/agents-server/src/app/agents/[agentName]/images/screenshot-fullhd.png/route.tsx
CHANGED
|
@@ -7,6 +7,7 @@ import { textColor } from '../../../../../../../../src/utils/color/operators/fur
|
|
|
7
7
|
import { grayscale } from '../../../../../../../../src/utils/color/operators/grayscale';
|
|
8
8
|
import { keepUnused } from '../../../../../../../../src/utils/organization/keepUnused';
|
|
9
9
|
import { getAgentName, getAgentProfile } from '../../_utils';
|
|
10
|
+
import { NEXT_PUBLIC_SITE_URL } from '@/config';
|
|
10
11
|
|
|
11
12
|
const size = {
|
|
12
13
|
width: 1920,
|
|
@@ -51,7 +52,7 @@ export async function GET(request: Request, { params }: { params: Promise<{ agen
|
|
|
51
52
|
backgroundColor: agentColor.toHex(),
|
|
52
53
|
borderRadius: '50%',
|
|
53
54
|
}}
|
|
54
|
-
src={agentProfile.meta.image || agentProfile.permanentId ||generatePlaceholderAgentProfileImageUrl(agentName)}
|
|
55
|
+
src={agentProfile.meta.image || agentProfile.permanentId ||generatePlaceholderAgentProfileImageUrl(agentName, NEXT_PUBLIC_SITE_URL)}
|
|
55
56
|
alt="Agent Icon"
|
|
56
57
|
/>
|
|
57
58
|
</div>
|
|
@@ -7,6 +7,7 @@ import { textColor } from '../../../../../../../../src/utils/color/operators/fur
|
|
|
7
7
|
import { grayscale } from '../../../../../../../../src/utils/color/operators/grayscale';
|
|
8
8
|
import { keepUnused } from '../../../../../../../../src/utils/organization/keepUnused';
|
|
9
9
|
import { getAgentName, getAgentProfile } from '../../_utils';
|
|
10
|
+
import { NEXT_PUBLIC_SITE_URL } from '@/config';
|
|
10
11
|
|
|
11
12
|
const size = {
|
|
12
13
|
width: 1080,
|
|
@@ -51,7 +52,7 @@ export async function GET(request: Request, { params }: { params: Promise<{ agen
|
|
|
51
52
|
backgroundColor: agentColor.toHex(),
|
|
52
53
|
borderRadius: '50%',
|
|
53
54
|
}}
|
|
54
|
-
src={agentProfile.meta.image || agentProfile.permanentId ||generatePlaceholderAgentProfileImageUrl(agentName)}
|
|
55
|
+
src={agentProfile.meta.image || agentProfile.permanentId ||generatePlaceholderAgentProfileImageUrl(agentName, NEXT_PUBLIC_SITE_URL)}
|
|
55
56
|
alt="Agent Icon"
|
|
56
57
|
/>
|
|
57
58
|
</div>
|
|
@@ -20,6 +20,7 @@ import { CopyField } from '../CopyField';
|
|
|
20
20
|
import { generateAgentMetadata } from '../generateAgentMetadata';
|
|
21
21
|
import { SdkCodeTabs } from './SdkCodeTabs';
|
|
22
22
|
import { WebsiteIntegrationTabs } from './WebsiteIntegrationTabs';
|
|
23
|
+
import { NEXT_PUBLIC_SITE_URL } from '@/config';
|
|
23
24
|
|
|
24
25
|
export const generateMetadata = generateAgentMetadata;
|
|
25
26
|
|
|
@@ -187,7 +188,7 @@ export default async function AgentIntegrationPage({ params }: { params: Promise
|
|
|
187
188
|
{agentProfile.meta.image && (
|
|
188
189
|
// eslint-disable-next-line @next/next/no-img-element
|
|
189
190
|
<img
|
|
190
|
-
src={agentProfile.meta.image || agentProfile.permanentId ||generatePlaceholderAgentProfileImageUrl(agentName)}
|
|
191
|
+
src={agentProfile.meta.image || agentProfile.permanentId ||generatePlaceholderAgentProfileImageUrl(agentName, NEXT_PUBLIC_SITE_URL)}
|
|
191
192
|
alt={agentProfile.meta.fullname || agentName}
|
|
192
193
|
className="w-16 h-16 rounded-full object-cover border-2"
|
|
193
194
|
style={{ borderColor: primaryColor }}
|
|
@@ -13,6 +13,7 @@ import { getAgentName, getAgentProfile } from '../_utils';
|
|
|
13
13
|
import { getAgentExternalLinks, getAgentLinks } from '../agentLinks';
|
|
14
14
|
import { CopyField } from '../CopyField';
|
|
15
15
|
import { generateAgentMetadata } from '../generateAgentMetadata';
|
|
16
|
+
import { NEXT_PUBLIC_SITE_URL } from '@/config';
|
|
16
17
|
|
|
17
18
|
export const generateMetadata = generateAgentMetadata;
|
|
18
19
|
|
|
@@ -56,7 +57,7 @@ export default async function AgentLinksPage({ params }: { params: Promise<{ age
|
|
|
56
57
|
{agentProfile.meta.image && (
|
|
57
58
|
// eslint-disable-next-line @next/next/no-img-element
|
|
58
59
|
<img
|
|
59
|
-
src={agentProfile.meta.image || agentProfile.permanentId || generatePlaceholderAgentProfileImageUrl(agentName)}
|
|
60
|
+
src={agentProfile.meta.image || agentProfile.permanentId || generatePlaceholderAgentProfileImageUrl(agentName, NEXT_PUBLIC_SITE_URL)}
|
|
60
61
|
alt={agentProfile.meta.fullname || agentName}
|
|
61
62
|
className="w-16 h-16 rounded-full object-cover border-2"
|
|
62
63
|
style={{ borderColor: primaryColor }}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { NEXT_PUBLIC_SITE_URL } from '@/config';
|
|
1
2
|
import { generatePlaceholderAgentProfileImageUrl, PROMPTBOOK_COLOR } from '@promptbook-local/core';
|
|
2
3
|
import { serializeError } from '@promptbook-local/utils';
|
|
3
4
|
import { ImageResponse } from 'next/og';
|
|
@@ -57,7 +58,10 @@ export default async function Image({ params }: { params: Promise<{ agentName: s
|
|
|
57
58
|
src={
|
|
58
59
|
agentProfile.meta.image ||
|
|
59
60
|
agentProfile.permanentId ||
|
|
60
|
-
generatePlaceholderAgentProfileImageUrl(
|
|
61
|
+
generatePlaceholderAgentProfileImageUrl(
|
|
62
|
+
agentProfile.permanentId || agentName,
|
|
63
|
+
NEXT_PUBLIC_SITE_URL,
|
|
64
|
+
)
|
|
61
65
|
}
|
|
62
66
|
alt="Agent Icon"
|
|
63
67
|
/>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use server';
|
|
2
2
|
|
|
3
|
+
import { NEXT_PUBLIC_SITE_URL } from '@/config';
|
|
3
4
|
import { $provideServer } from '@/src/tools/$provideServer';
|
|
4
5
|
import { isUserAdmin } from '@/src/utils/isUserAdmin';
|
|
5
6
|
import { saturate } from '@promptbook-local/color';
|
|
@@ -98,7 +99,7 @@ export default async function AgentPage({
|
|
|
98
99
|
avatarSrc={
|
|
99
100
|
agentProfile.meta.image ||
|
|
100
101
|
agentProfile.permanentId ||
|
|
101
|
-
generatePlaceholderAgentProfileImageUrl(agentName)
|
|
102
|
+
generatePlaceholderAgentProfileImageUrl(agentName, NEXT_PUBLIC_SITE_URL)
|
|
102
103
|
}
|
|
103
104
|
isDeleted={isDeleted}
|
|
104
105
|
/>
|
|
@@ -9,6 +9,7 @@ import { $sideEffect } from '../../../../../../../src/utils/organization/$sideEf
|
|
|
9
9
|
import { getAgentName, getAgentProfile } from '../_utils';
|
|
10
10
|
import { generateAgentMetadata } from '../generateAgentMetadata';
|
|
11
11
|
import { generatePlaceholderAgentProfileImageUrl } from '@promptbook-local/core';
|
|
12
|
+
import { NEXT_PUBLIC_SITE_URL } from '@/config';
|
|
12
13
|
|
|
13
14
|
export const generateMetadata = generateAgentMetadata;
|
|
14
15
|
|
|
@@ -45,7 +46,7 @@ export default async function AgentSystemMessagePage({ params }: { params: Promi
|
|
|
45
46
|
{agentProfile.meta.image && (
|
|
46
47
|
// eslint-disable-next-line @next/next/no-img-element
|
|
47
48
|
<img
|
|
48
|
-
src={agentProfile.meta.image|| agentProfile.permanentId ||generatePlaceholderAgentProfileImageUrl(agentName)}
|
|
49
|
+
src={agentProfile.meta.image|| agentProfile.permanentId ||generatePlaceholderAgentProfileImageUrl(agentName, NEXT_PUBLIC_SITE_URL)}
|
|
49
50
|
alt={agentProfile.meta.fullname || agentName}
|
|
50
51
|
className="w-16 h-16 rounded-full object-cover border-2 border-gray-200"
|
|
51
52
|
/>
|
|
@@ -7,6 +7,7 @@ import { useState } from 'react';
|
|
|
7
7
|
import { AgentQrCode } from './AgentQrCode';
|
|
8
8
|
import { QrCodeModal } from './QrCodeModal';
|
|
9
9
|
import { useAgentBackground } from './useAgentBackground';
|
|
10
|
+
import { NEXT_PUBLIC_SITE_URL } from '@/config';
|
|
10
11
|
|
|
11
12
|
type AgentProfileProps = {
|
|
12
13
|
/**
|
|
@@ -75,7 +76,7 @@ export function AgentProfile(props: AgentProfileProps) {
|
|
|
75
76
|
const { meta, agentName } = agent;
|
|
76
77
|
const fullname = (meta.fullname as string) || agentName || 'Agent';
|
|
77
78
|
const personaDescription = agent.personaDescription || '';
|
|
78
|
-
const imageUrl = meta.image || generatePlaceholderAgentProfileImageUrl(permanentId);
|
|
79
|
+
const imageUrl = meta.image || generatePlaceholderAgentProfileImageUrl(permanentId, NEXT_PUBLIC_SITE_URL);
|
|
79
80
|
|
|
80
81
|
const [isQrModalOpen, setIsQrModalOpen] = useState(false);
|
|
81
82
|
const [isFlipped, setIsFlipped] = useState(false);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { NEXT_PUBLIC_SITE_URL } from '@/config';
|
|
3
4
|
import { generatePlaceholderAgentProfileImageUrl } from '@promptbook-local/core';
|
|
4
5
|
import { really_any } from '@promptbook-local/types';
|
|
5
6
|
import { EyeIcon, EyeOffIcon, RotateCcwIcon } from 'lucide-react';
|
|
@@ -33,7 +34,7 @@ export function AgentCard({
|
|
|
33
34
|
}: AgentCardProps) {
|
|
34
35
|
const { meta, agentName } = agent;
|
|
35
36
|
const fullname = (meta.fullname as string) || agentName || 'Agent';
|
|
36
|
-
const imageUrl = meta.image || generatePlaceholderAgentProfileImageUrl(agentName);
|
|
37
|
+
const imageUrl = meta.image || generatePlaceholderAgentProfileImageUrl(agentName, NEXT_PUBLIC_SITE_URL);
|
|
37
38
|
const personaDescription = agent.personaDescription || '';
|
|
38
39
|
|
|
39
40
|
const { brandColorLightHex, brandColorDarkHex, backgroundImage } = useAgentBackground(meta.color);
|
package/esm/index.es.js
CHANGED
|
@@ -47,7 +47,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
47
47
|
* @generated
|
|
48
48
|
* @see https://github.com/webgptorg/promptbook
|
|
49
49
|
*/
|
|
50
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-
|
|
50
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.104.0-7';
|
|
51
51
|
/**
|
|
52
52
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
53
53
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -57,6 +57,8 @@ const PROMPTBOOK_ENGINE_VERSION = '0.104.0-6';
|
|
|
57
57
|
* Core Promptbook server configuration.
|
|
58
58
|
*
|
|
59
59
|
* This server is also used for auto-federation in the Agents Server.
|
|
60
|
+
*
|
|
61
|
+
* @public exported from `@promptbook/core`
|
|
60
62
|
*/
|
|
61
63
|
const CORE_SERVER = {
|
|
62
64
|
title: 'Promptbook Core',
|
|
@@ -11402,11 +11404,7 @@ const modelCommandParser = {
|
|
|
11402
11404
|
// TODO: [🚜] DRY
|
|
11403
11405
|
if ($taskJson.modelRequirements[command.key] !== undefined) {
|
|
11404
11406
|
if ($taskJson.modelRequirements[command.key] === command.value) {
|
|
11405
|
-
console.warn(`Multiple commands \`MODEL ${{
|
|
11406
|
-
modelName: 'NAME',
|
|
11407
|
-
modelVariant: 'VARIANT',
|
|
11408
|
-
maxTokens: '???',
|
|
11409
|
-
}[command.key]} ${command.value}\` in the task "${$taskJson.title || $taskJson.name}"`);
|
|
11407
|
+
console.warn(`Multiple commands \`MODEL ${command.key} ${command.value}\` in the task "${$taskJson.title || $taskJson.name}"`);
|
|
11410
11408
|
// <- TODO: [🏮] Some standard way how to transform errors into warnings and how to handle non-critical fails during the tasks
|
|
11411
11409
|
}
|
|
11412
11410
|
else {
|
|
@@ -19892,13 +19890,14 @@ class OpenAiCompatibleExecutionTools {
|
|
|
19892
19890
|
const modelName = currentModelRequirements.modelName || this.getDefaultImageGenerationModel().modelName;
|
|
19893
19891
|
const modelSettings = {
|
|
19894
19892
|
model: modelName,
|
|
19895
|
-
|
|
19896
|
-
|
|
19897
|
-
|
|
19893
|
+
size: currentModelRequirements.size,
|
|
19894
|
+
quality: currentModelRequirements.quality,
|
|
19895
|
+
style: currentModelRequirements.style,
|
|
19898
19896
|
};
|
|
19899
19897
|
const rawPromptContent = templateParameters(content, { ...parameters, modelName });
|
|
19900
19898
|
const rawRequest = {
|
|
19901
19899
|
...modelSettings,
|
|
19900
|
+
size: modelSettings.size || '1024x1024',
|
|
19902
19901
|
prompt: rawPromptContent,
|
|
19903
19902
|
user: (_a = this.options.userId) === null || _a === void 0 ? void 0 : _a.toString(),
|
|
19904
19903
|
response_format: 'url', // TODO: [🧠] Maybe allow b64_json
|