{"id":37734,"date":"2024-12-03T21:57:05","date_gmt":"2024-12-03T20:57:05","guid":{"rendered":"https:\/\/help.qualiware.it\/qw-help\/?p=37734"},"modified":"2025-05-04T15:49:36","modified_gmt":"2025-05-04T13:49:36","slug":"analisi-di-un-documento-con-gpt","status":"publish","type":"post","link":"https:\/\/help.qualiware.it\/qw-help\/analisi-di-un-documento-con-gpt\/","title":{"rendered":"Analisi di un documento con GPT"},"content":{"rendered":"<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"csharp\">' Il seguente codice analizza un'immagine o un documento utilizzando GPT\r\n\r\ndim path as string ' assegnare a questa variabile il percorso del file\r\ndim domanda as string ' assegnare a questa variabile la specifica del tipo di analisi da fare sul documento. Se si desidera che venga ritornato un JSON, inserire \"JSON\" nella domanda e l'elenco dei campi da estrarre e di cosa devono contenere. Dalla release 2025.00.03, se si desidera che il documento venga trasformato in Excel \u00e8 sufficiente inserire la parola \"Excel\" nella domanda, e nella risposta vi sar\u00e0 un link per scaricare l'Excel generato.\r\n\r\nif dbdollar(\".jpg\",lower(path)) or dbdollar(\".png\",lower(path)) or dbdollar(\".jpeg\",lower(path))\r\n\t' converte l'immagine in BASE64\r\n    domanda+=ImageToBase64(path)\r\nElse\r\n    if dbdollar(\".pdf\",lower(path))\r\n\t\t' Effettua l'OCR\r\n        PDFOcr(Parameter1,path,300,\"ita\")\r\n    Else\r\n        Path=path\r\n    End If\r\n\r\n    domanda+=\"dal seguente testo:\"+vbCr+Search2_Extract_Text(path)\r\nEnd If\r\n\r\nDim errmsg As String\r\ndim risposta as string\r\nOpenAIChatAsk(form.GetSession(),domanda,risposta,errmsg)\r\n\r\nIf Empty(errmsg)\r\n    ' la variabile risposta contiene l'analisi effettuata, in formato JSON se la domanda contiene \"JSON\"\r\nElse\r\n    form.Alert(errmsg)\r\nEnd If\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>&#8216; Il seguente codice analizza un&#8217;immagine o un documento utilizzando GPT dim path as string &#8216; assegnare a questa variabile il percorso del file dim domanda as string &#8216; assegnare a questa variabile la specifica del tipo di analisi da fare sul documento. Se si desidera che venga ritornato un JSON, inserire &#8220;JSON&#8221; nella domanda&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"ngg_post_thumbnail":0,"footnotes":""},"categories":[65],"tags":[71,82],"acf":[],"_links":{"self":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/37734"}],"collection":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/comments?post=37734"}],"version-history":[{"count":3,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/37734\/revisions"}],"predecessor-version":[{"id":37829,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/posts\/37734\/revisions\/37829"}],"wp:attachment":[{"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/media?parent=37734"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/categories?post=37734"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/help.qualiware.it\/qw-help\/wp-json\/wp\/v2\/tags?post=37734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}