Mission Refactor Big

This commit is contained in:
alma 2026-01-09 13:49:11 +01:00
parent ad3faa194b
commit 269734ef25
2 changed files with 9 additions and 2 deletions

View File

@ -94,7 +94,14 @@ export async function POST(
let actionPlan: string;
try {
const result = JSON.parse(responseText);
let result = JSON.parse(responseText);
// N8N might return an array like [{"response":"..."}] when responseData is "allEntries"
if (Array.isArray(result) && result.length > 0) {
result = result[0];
logger.debug('N8N returned array, using first element');
}
// N8N returns { "response": "..." } based on the workflow
actionPlan = result.response || result.plan || result.actionPlan || result.content || result.text || responseText;

View File

@ -591,7 +591,7 @@ export default function MissionDetailPage() {
value={editedPlan}
onChange={(e) => setEditedPlan(e.target.value)}
placeholder="Le plan d'action généré apparaîtra ici. Vous pouvez le modifier après génération."
className="min-h-[400px] font-mono text-sm bg-gray-50 border-gray-200"
className="min-h-[400px] font-mono text-sm bg-white text-gray-900 border-gray-300 focus:border-blue-500 focus:ring-blue-500"
/>
{isPlanModified && (
<p className="text-sm text-amber-600 flex items-center gap-1">