Fix CSS layout width and add more user friendly messages
This commit is contained in:
@@ -6,13 +6,23 @@ import { schemaForRepoRelativePath } from '@dynamic-sites/shared';
|
||||
import { createProposal, getProposal, updateProposalStatus } from '../db.js';
|
||||
import { writeContentFile } from '../io/write-content.js';
|
||||
import { generateEditedJson, routeEditIntent, generateSummary, classifyMessageIntent, generateInfoResponse } from '../llm/client.js';
|
||||
import { buildSectionManifest } from './manifest.js';
|
||||
import { buildSectionManifest, type ManifestEntry } from './manifest.js';
|
||||
import { sendSms } from '../sms/reply.js';
|
||||
import { SMS_TEMPLATES } from '../sms/templates.js';
|
||||
import { logger } from '../logger.js';
|
||||
|
||||
const REPO_ROOT = process.env.REPO_ROOT || '.';
|
||||
|
||||
/** Get a friendly display name for a manifest entry. */
|
||||
function sectionDisplayName(m: ManifestEntry): string {
|
||||
return m.title || m.headline || m.heading || m.id;
|
||||
}
|
||||
|
||||
/** Get a comma-separated list of friendly section names from a manifest. */
|
||||
function sectionNameList(manifest: ManifestEntry[]): string {
|
||||
return manifest.map(sectionDisplayName).join(', ');
|
||||
}
|
||||
|
||||
/**
|
||||
* In-memory map from job ID → proposal ID.
|
||||
* Used by the HTTP API to let the editor poll for a proposal created by a queued job.
|
||||
@@ -80,7 +90,7 @@ async function handlePropose(job: Extract<EditJobPayload, { kind: 'propose' }>)
|
||||
log.info({ event: 'routing.ambiguous' }, 'Routing ambiguous');
|
||||
if (job.smsReplyMeta) {
|
||||
await sendSms(job.smsReplyMeta.from, job.smsReplyMeta.to,
|
||||
routing.clarification_message || SMS_TEMPLATES.ROUTING_AMBIGUOUS(manifest.map(m => m.id).join(', '))
|
||||
routing.clarification_message || SMS_TEMPLATES.ROUTING_AMBIGUOUS(sectionNameList(manifest))
|
||||
);
|
||||
}
|
||||
return;
|
||||
@@ -96,7 +106,8 @@ async function handlePropose(job: Extract<EditJobPayload, { kind: 'propose' }>)
|
||||
if (!fs.existsSync(absPath)) {
|
||||
log.error({ event: 'propose.file_not_found', path: repoRelativePath }, 'Target file not found');
|
||||
if (job.smsReplyMeta) {
|
||||
await sendSms(job.smsReplyMeta.from, job.smsReplyMeta.to, SMS_TEMPLATES.ROUTING_NO_MATCH(repoRelativePath));
|
||||
const manifest = buildSectionManifest();
|
||||
await sendSms(job.smsReplyMeta.from, job.smsReplyMeta.to, SMS_TEMPLATES.ROUTING_NO_MATCH(sectionNameList(manifest)));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user