diff --git a/src/components/AIQueryInterface.astro b/src/components/AIQueryInterface.astro index 6aa81b5..fb1eeb7 100644 --- a/src/components/AIQueryInterface.astro +++ b/src/components/AIQueryInterface.astro @@ -37,15 +37,14 @@ const tools = data.tools;
-

+

- Die Anfrage wird an mistral.ai übertragen und unterliegt deren - Datenschutzrichtlinien. - Eine typische Anfrage kostet mich $0.0008. + Ihre Anfrage wird an mistral.ai übertragen und unterliegt deren + Datenschutzrichtlinien

@@ -228,6 +227,54 @@ document.addEventListener('DOMContentLoaded', () => { } }; + // Helper function to format workflow suggestions as proper lists + function formatWorkflowSuggestion(text) { + // Check if text contains numbered list items (1., 2., 3., etc.) + const numberedListPattern = /(\d+\.\s)/g; + + if (numberedListPattern.test(text)) { + // Split by numbered items and clean up + const items = text.split(/\d+\.\s/).filter(item => item.trim().length > 0); + + if (items.length > 1) { + const listItems = items.map(item => + `
  • ${item.trim()}
  • ` + ).join(''); + + return `
      ${listItems}
    `; + } + } + + // Check for bullet points (-, *, •) + const bulletPattern = /^[\s]*[-\*•]\s/gm; + if (bulletPattern.test(text)) { + const items = text.split(/^[\s]*[-\*•]\s/gm).filter(item => item.trim().length > 0); + + if (items.length > 1) { + const listItems = items.map(item => + `
  • ${item.trim()}
  • ` + ).join(''); + + return ``; + } + } + + // Check for line breaks that might indicate separate points + if (text.includes('\n')) { + const lines = text.split('\n').filter(line => line.trim().length > 0); + if (lines.length > 1) { + const listItems = lines.map(line => + `
  • ${line.trim()}
  • ` + ).join(''); + + return ``; + } + } + + // Fallback to regular paragraph if no list format detected + return `

    ${text}

    `; + } + function displayResults(recommendation, originalQuery) { // Group tools by phase const toolsByPhase = {}; @@ -276,7 +323,7 @@ document.addEventListener('DOMContentLoaded', () => { Szenario-Analyse -

    ${recommendation.scenario_analysis}

    + ${formatWorkflowSuggestion(recommendation.scenario_analysis)} ` : ''} @@ -355,7 +402,7 @@ document.addEventListener('DOMContentLoaded', () => { Workflow-Empfehlung -

    ${recommendation.workflow_suggestion}

    + ${formatWorkflowSuggestion(recommendation.workflow_suggestion)} ` : ''} @@ -369,7 +416,9 @@ document.addEventListener('DOMContentLoaded', () => { Wichtige Hinweise -

    ${recommendation.additional_notes}

    +
    + ${formatWorkflowSuggestion(recommendation.additional_notes).replace(/color: var\(--color-text\)/g, 'color: white')} +
    ` : ''}