Conversation
| // ── Upload helpers ───────────────────────────────────────────────────────────── | ||
|
|
||
| /** Build a FormData for any upload call, including the per-chart upload nonce. */ | ||
| function uploadForm( action, chartId, uploadNonce, fields = {} ) { | ||
| const form = new FormData(); | ||
| form.append( 'action', action ); | ||
| form.append( 'nonce', uploadNonce ); | ||
| form.append( 'chart_id', chartId ); | ||
| for ( const [ key, val ] of Object.entries( fields ) ) { | ||
| if ( val !== null && val !== undefined && val !== '' ) { | ||
| form.append( key, val ); | ||
| } | ||
| } | ||
| return form; | ||
| } | ||
|
|
||
| async function uploadFetch( form ) { | ||
| const res = await fetch( ajaxUrl, { method: 'POST', body: form } ); | ||
| let json; | ||
| try { | ||
| json = await res.json(); | ||
| } catch { | ||
| throw new Error( 'Server returned an unexpected response.' ); | ||
| } | ||
| if ( ! json.success ) { | ||
| throw new Error( json.data?.message || 'Upload failed.' ); | ||
| } | ||
| return json.data; | ||
| } |
There was a problem hiding this comment.
I see that there are two functions with the same structure for fetch: uploadFetch and post; post also contains some elements from uploadForm.
I think we can only use post.
/** Upload a remote CSV/XLSX URL. Returns { series, data }. */
export async function uploadFileUrl( chartId, uploadNonce, url, schedule = '' ) {
return post( 'visualizer-ai-upload', {
chart_id: chartId,
nonce: uploadNonce,
source_type: 'file_url',
file_url: url,
schedule: schedule,
} );
}|
a small thing @HardeepAsrani , can we show manual data in a table like format? vs csv like? |
|
@HardeepAsrani just some toughts about the UI:
|
|
some more feedback @HardeepAsrani https://www.loom.com/share/1cafed8651d84b229e39c001c9ac35af. for manual code we can have a doc telling people that they can explore different ai systems to enhance that or manually tweak it |
|




Summary
This PR adds an AI wizard to Visualizer.
Will affect visual aspect of the product
YES/NO
Screenshots
Test instructions
Check before Pull Request is ready:
Closes https://github.com/Codeinwp/visualizer-pro/issues/577, https://github.com/Codeinwp/visualizer-pro/issues/571.