- corretto gruppomacro catalogo, info prodotti, estrazione dati da amazon corretto.

This commit is contained in:
Surya Paolo
2025-09-27 17:24:40 +02:00
parent c8589e794f
commit d6c0bcf879
13 changed files with 330 additions and 252 deletions

View File

@@ -1,11 +1,4 @@
import {
PropType,
computed,
defineComponent,
onMounted,
ref,
watch,
} from 'vue';
import { PropType, computed, defineComponent, onMounted, ref, watch } from 'vue';
import draggable from 'vuedraggable';
import { tools } from '@tools';
@@ -87,10 +80,14 @@ export default defineComponent({
const myproduct = ref<IProduct>({ ...props.modelValue });
const id = computed(() => myproduct.value.productInfo._id);
const id = computed(() => myproduct.value._id);
const myvalue = computed<string>(() => {
return myproduct.value.productInfo[props.mykey];
if (props.mysubkey) {
return myproduct.value[props.mykey][props.mysubkey];
} else {
return myproduct.value[props.mykey];
}
});
watch(
@@ -105,7 +102,8 @@ export default defineComponent({
loading.value = true;
try {
const myscrapingbookrec = await products.loadMyScrapingBook(
myproduct.value.isbn, false
myproduct.value.isbn,
false
);
myscrapingbook.value = myscrapingbookrec;
} catch (error) {
@@ -152,10 +150,7 @@ export default defineComponent({
}
async function updateproduct(load?: boolean) {
myproduct.value = await products.getProductById(
myproduct.value._id,
load
);
myproduct.value = await products.getProductById(myproduct.value._id, load);
}
const copyToClipboard = (text) => {
@@ -187,8 +182,9 @@ export default defineComponent({
function getPrompt() {
// Prompt:
let mydescr = 'Scrivimi la sinossi del libro che ti indicherò, che andrà in un catalogo libri, la lunghezza del testo finale dev\'essere compresa tra 760 e 780 caratteri, senza spiegazione, senza titolo iniziale, solo la sinossi. Togli eventuali riferimenti a chi ha fatto la prefazione. Rendilo un po\' accattivante, ma non troppo. Senza immagine. Non inserire nessun link o riferimenti esterni o citazioni esterne. L\'output è solo la sinossi, senza altre spiegazioni. \n\n';
return mydescr
let mydescr =
"Scrivimi la sinossi del libro che ti indicherò, che andrà in un catalogo libri, la lunghezza del testo finale dev'essere compresa tra 760 e 780 caratteri, senza spiegazione, senza titolo iniziale, solo la sinossi. Togli eventuali riferimenti a chi ha fatto la prefazione. Rendilo un po' accattivante, ma non troppo. Senza immagine. Non inserire nessun link o riferimenti esterni o citazioni esterne. L'output è solo la sinossi, senza altre spiegazioni. \n\n";
return mydescr;
}
function copyDescrizioneFromScrapingData() {
@@ -197,9 +193,14 @@ export default defineComponent({
const data = myscrapingbook.value;
if (!data) return false;
mydescr = getPrompt()
mydescr = getPrompt();
mydescr += 'Titolo Libro: ' + data.titolo + '\n';
mydescr += 'Autore Libro: ' + (data?.autore.trim() ? data?.autore.trim() : products.getAutoriByArrayAuthors(myproduct?.value.productInfo?.authors)) + '\n';
mydescr +=
'Autore Libro: ' +
(data?.autore.trim()
? data?.autore.trim()
: products.getAutoriByArrayAuthors(myproduct?.value.productInfo?.authors)) +
'\n';
mydescr += 'DESCRIZIONE LIBRO: \n';
mydescr += data.descrizione_lunga;
@@ -210,9 +211,12 @@ export default defineComponent({
function copyDescrizioneFromGruppoMacro() {
let mydescr = '';
mydescr = getPrompt()
mydescr = getPrompt();
mydescr += 'Titolo Libro: ' + myproduct?.value.productInfo?.name + '\n';
mydescr += 'Autore Libro: ' + products.getAutoriByArrayAuthors(myproduct?.value.productInfo?.authors) + '\n';
mydescr +=
'Autore Libro: ' +
products.getAutoriByArrayAuthors(myproduct?.value.productInfo?.authors) +
'\n';
mydescr += 'DESCRIZIONE LIBRO: \n';
mydescr += myproduct?.value.productInfo?.descrizione_completa_macro;