mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-05 16:23:36 +00:00
Expose imageModel to system prompt
This commit is contained in:
2 files changed
+11
-3
No files matched your search
@@ -63,7 +63,7 @@ export class SessionManager {
|
||||
private listeners: Partial<Record<keyof SessionManagerEvents, Set<(...args: unknown[]) => void>>> = {};
|
||||
private fs: JSRuntimeFS;
|
||||
private nostr: NPool;
|
||||
private getSettings: () => { providers: AIProvider[] };
|
||||
private getSettings: () => { providers: AIProvider[]; imageModel?: string };
|
||||
private getConfig: () => AppConfig;
|
||||
private getDefaultConfig: () => AppConfig;
|
||||
private getProviderModels?: () => Array<{ id: string; provider: string; contextLength?: number; pricing?: { prompt: import('decimal.js').Decimal; completion: import('decimal.js').Decimal } }>;
|
||||
@@ -72,7 +72,7 @@ export class SessionManager {
|
||||
constructor(
|
||||
fs: JSRuntimeFS,
|
||||
nostr: NPool,
|
||||
getSettings: () => { providers: AIProvider[] },
|
||||
getSettings: () => { providers: AIProvider[]; imageModel?: string },
|
||||
getConfig: () => AppConfig,
|
||||
getDefaultConfig: () => AppConfig,
|
||||
getProviderModels?: () => Array<{ id: string; provider: string; contextLength?: number; pricing?: { prompt: import('decimal.js').Decimal; completion: import('decimal.js').Decimal } }>,
|
||||
@@ -289,6 +289,9 @@ export class SessionManager {
|
||||
baseURL: provider.baseURL,
|
||||
};
|
||||
|
||||
// Get imageModel from settings
|
||||
const settings = this.getSettings();
|
||||
|
||||
const systemPrompt = await makeSystemPrompt({
|
||||
cwd: `${config.fsPathProjects}/${projectId}`,
|
||||
fs: this.fs,
|
||||
@@ -303,6 +306,7 @@ export class SessionManager {
|
||||
projectTemplate,
|
||||
model: modelInfo,
|
||||
provider: providerInfo,
|
||||
imageModel: settings.imageModel,
|
||||
});
|
||||
|
||||
// Helper function to filter out unsupported image formats (keep only JPG/JPEG/PNG)
|
||||
|
||||
+5
-1
@@ -33,6 +33,7 @@ export interface MakeSystemPromptOpts {
|
||||
projectTemplate?: { name: string; description: string; url: string };
|
||||
model: ModelInfo;
|
||||
provider: ProviderInfo;
|
||||
imageModel?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -183,6 +184,8 @@ When a project is first created, you (the AI) choose an appropriate template fro
|
||||
|
||||
Shakespeare supports AI-powered image generation. Users can configure an image model in **Settings > AI** under the "Advanced" section.
|
||||
|
||||
{% if imageModel %}- **Configured Image Model**: {{ imageModel }}{% else %}- **Image Model Status**: Not configured{% endif %}
|
||||
|
||||
**Important Notes:**
|
||||
- Not all models support image generation
|
||||
- If users experience issues with image generation, they should try selecting a different image model in Settings > AI
|
||||
@@ -250,7 +253,7 @@ Note: the badge should be displayed at its natural size. It is recommended to om
|
||||
{{ AGENTS }}{% endif %}`;
|
||||
|
||||
export async function makeSystemPrompt(opts: MakeSystemPromptOpts): Promise<string> {
|
||||
const { tools, mode, fs, cwd, config, defaultConfig, user, metadata, repositoryUrl, template, projectTemplate, model, provider } = opts;
|
||||
const { tools, mode, fs, cwd, config, defaultConfig, user, metadata, repositoryUrl, template, projectTemplate, model, provider, imageModel } = opts;
|
||||
|
||||
// Add current date
|
||||
const date = new Date().toLocaleDateString("en-US", {
|
||||
@@ -334,6 +337,7 @@ export async function makeSystemPrompt(opts: MakeSystemPromptOpts): Promise<stri
|
||||
projectTemplate,
|
||||
model,
|
||||
provider,
|
||||
imageModel,
|
||||
};
|
||||
|
||||
// Render the template with the context
|
||||
|
||||
Reference in new issue
Block a user