Skip to content

Commit 50fa3e4

Browse files
committed
feat: advanced implementation steps. looks overkill. we need to simplify this.
1 parent 10023f8 commit 50fa3e4

File tree

5 files changed

+387
-181
lines changed

5 files changed

+387
-181
lines changed

includes/admin/page-optimizer/src/app/page-optimizer/spaces/Optimizations.tsx

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,27 @@ const DiagnosticSchema = z.object({
4141
z.object({
4242
issue: z.string(),
4343
description: z.string(),
44-
howToFix: z.array(z.object({
45-
step: z.string(),
46-
description: z.string(),
47-
type: z.enum(['rapidload_fix', 'wordpress_fix', 'theme_fix', 'another_plugin_fix', 'code_fix', 'server_config_fix', 'server_upgrade_fix', 'other']),
48-
substeps: z.array(z.object({
49-
step: z.string(),
50-
description: z.string(),
51-
})).optional().describe('Substeps to fix the issue.'),
52-
rapidload_setting_input: z.object({
53-
name: z.string(),
54-
value: z.string().nullable(),
55-
original_current_value: z.string().nullable(),
56-
}).optional(),
57-
})),
58-
how_to_fix_reasoning_memory: z.string(),
59-
how_to_fix_questions: z.array(z.object({
60-
question: z.string(),
61-
explanation: z.string(),
62-
type: z.enum(['single_choice', 'multiple_choice', 'text', 'number']),
63-
options: z.array(z.object({
64-
value: z.string(),
65-
label: z.string(),
44+
solutions: z.object({
45+
solutions_reasoning: z.array(z.object({
46+
block_type: z.enum(['observation', 'analysis', 'hypothesis', 'validation', 'conclusion']),
47+
thought: z.string(),
48+
reasoning: z.string(),
49+
confidence_level: z.number().min(0).max(100),
50+
supporting_evidence: z.array(z.string()),
51+
related_blocks: z.array(z.string()).optional(),
52+
})),
53+
solutions_list: z.array(z.object({
54+
type: z.enum(['rapidload_fix', 'wordpress_fix', 'theme_fix', 'another_plugin_fix', 'code_fix', 'server_config_fix', 'server_upgrade_fix']),
55+
title: z.string(),
6656
description: z.string(),
57+
steps: z.array(z.object({
58+
step: z.number(),
59+
action: z.string(),
60+
details: z.string(),
61+
verification: z.string().optional()
62+
})),
6763
})),
68-
})),
64+
}),
6965
resources: z.array(z.object({
7066
name: z.string(),
7167
url: z.string(),
@@ -99,6 +95,8 @@ const Optimizations = ({ }) => {
9995
const { headerUrl, diagnosticLoading } = useCommonDispatch();
10096
const [remainingTime, setRemainingTime] = useState(0);
10197
const [serverDetails, setServerDetails] = useState(null);
98+
const [input, setInput] = useState(null);
99+
102100
useEffect(() => {
103101
console.log('diagnosticLoading', diagnosticLoading)
104102
}, [diagnosticLoading])
@@ -230,7 +228,7 @@ const Optimizations = ({ }) => {
230228

231229
try {
232230

233-
console.log(input)
231+
setInput(input)
234232
submit(input)
235233
setDiagnosticsProgress(95);
236234

@@ -612,8 +610,8 @@ const Optimizations = ({ }) => {
612610
</button>
613611
</div>
614612
<iframe
615-
// src={showIframe ? `${optimizerUrl}/?rapidload_preview` : ''}
616-
src={showIframe ? 'http://rapidload.local/?rapidload_preview' : ''}
613+
src={showIframe ? `${optimizerUrl}/?rapidload_preview` : ''}
614+
// src={showIframe ? 'http://rapidload.local/?rapidload_preview' : ''}
617615
className="w-full h-[600px] border-0"
618616
title="Optimization Test"
619617
/>
@@ -622,7 +620,13 @@ const Optimizations = ({ }) => {
622620
)}
623621
</div>
624622

625-
{diagnosticResults?.AnalysisSummary?.length && <AnalysisResults object={diagnosticResults} relatedAudits={relatedAudits} />}
623+
{diagnosticResults?.AnalysisSummary?.length &&
624+
<AnalysisResults
625+
object={diagnosticResults}
626+
relatedAudits={relatedAudits}
627+
input={input}
628+
/>
629+
}
626630
</m.div>
627631
</AnimatePresence>
628632
)

0 commit comments

Comments
 (0)