docs-combiner 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/renderer.js +73 -6
- package/dist/renderer.js.map +1 -1
- package/package.json +1 -1
package/dist/renderer.js
CHANGED
|
@@ -89978,6 +89978,37 @@ function App() {
|
|
|
89978
89978
|
const trimmed = value.trim();
|
|
89979
89979
|
if (!trimmed)
|
|
89980
89980
|
return { price: '', currency: '' };
|
|
89981
|
+
// Currency symbol to code mapping
|
|
89982
|
+
const currencySymbolMap = {
|
|
89983
|
+
'₦': 'NGN', // Nigerian Naira
|
|
89984
|
+
'€': 'EUR', // Euro
|
|
89985
|
+
'$': 'USD', // US Dollar (also used for other dollars)
|
|
89986
|
+
'£': 'GBP', // British Pound
|
|
89987
|
+
'¥': 'JPY', // Japanese Yen
|
|
89988
|
+
'₹': 'INR', // Indian Rupee
|
|
89989
|
+
'₽': 'RUB', // Russian Ruble
|
|
89990
|
+
'₴': 'UAH', // Ukrainian Hryvnia
|
|
89991
|
+
'₸': 'KZT', // Kazakhstani Tenge
|
|
89992
|
+
'₪': 'ILS', // Israeli Shekel
|
|
89993
|
+
'₨': 'PKR', // Pakistani Rupee / Sri Lankan Rupee (ambiguous, defaulting to PKR)
|
|
89994
|
+
'₫': 'VND', // Vietnamese Dong
|
|
89995
|
+
'₱': 'PHP', // Philippine Peso
|
|
89996
|
+
'₩': 'KRW', // South Korean Won
|
|
89997
|
+
'₡': 'CRC', // Costa Rican Colón
|
|
89998
|
+
'₵': 'GHS', // Ghanaian Cedi
|
|
89999
|
+
'₮': 'MNT', // Mongolian Tugrik
|
|
90000
|
+
'₯': 'GRD', // Greek Drachma (obsolete)
|
|
90001
|
+
'₰': 'DEM', // German Mark (obsolete)
|
|
90002
|
+
'₲': 'PYG', // Paraguayan Guaraní
|
|
90003
|
+
'₳': 'ARA', // Argentine Austral (obsolete)
|
|
90004
|
+
'₶': 'LVL', // Latvian Lats (obsolete)
|
|
90005
|
+
'₷': 'EEK', // Estonian Kroon (obsolete)
|
|
90006
|
+
'₺': 'TRY', // Turkish Lira
|
|
90007
|
+
'₼': 'AZN', // Azerbaijani Manat
|
|
90008
|
+
'₾': 'GEL', // Georgian Lari
|
|
90009
|
+
'₿': 'BTC', // Bitcoin
|
|
90010
|
+
'¢': 'USD', // Cent (US)
|
|
90011
|
+
};
|
|
89981
90012
|
// Currency name to code mapping
|
|
89982
90013
|
const currencyMap = {
|
|
89983
90014
|
'euro': 'EUR',
|
|
@@ -90008,8 +90039,30 @@ function App() {
|
|
|
90008
90039
|
'dkk': 'DKK',
|
|
90009
90040
|
'koruna': 'CZK',
|
|
90010
90041
|
'koruny': 'CZK',
|
|
90011
|
-
'czk': 'CZK'
|
|
90042
|
+
'czk': 'CZK',
|
|
90043
|
+
'naira': 'NGN',
|
|
90044
|
+
'nairas': 'NGN',
|
|
90045
|
+
'ngn': 'NGN'
|
|
90012
90046
|
};
|
|
90047
|
+
// First, check for currency symbols (before or after the number)
|
|
90048
|
+
// Check if first character is a currency symbol (e.g., "₦48900" or "₦ 48900")
|
|
90049
|
+
const firstChar = trimmed[0];
|
|
90050
|
+
if (currencySymbolMap[firstChar]) {
|
|
90051
|
+
const rest = trimmed.slice(1).trim();
|
|
90052
|
+
const priceMatch = rest.match(/^(\d+(?:\.\d+)?)$/);
|
|
90053
|
+
if (priceMatch) {
|
|
90054
|
+
return { price: priceMatch[1], currency: currencySymbolMap[firstChar], currencySymbol: firstChar };
|
|
90055
|
+
}
|
|
90056
|
+
}
|
|
90057
|
+
// Check if last character is a currency symbol (e.g., "48900 ₦" or "48900₦")
|
|
90058
|
+
const lastChar = trimmed[trimmed.length - 1];
|
|
90059
|
+
if (currencySymbolMap[lastChar]) {
|
|
90060
|
+
const rest = trimmed.slice(0, -1).trim();
|
|
90061
|
+
const priceMatch = rest.match(/^(\d+(?:\.\d+)?)$/);
|
|
90062
|
+
if (priceMatch) {
|
|
90063
|
+
return { price: priceMatch[1], currency: currencySymbolMap[lastChar], currencySymbol: lastChar };
|
|
90064
|
+
}
|
|
90065
|
+
}
|
|
90013
90066
|
// Try to match pattern: number followed by currency code (3 letters)
|
|
90014
90067
|
const match = trimmed.match(/^(\d+(?:\.\d+)?)\s+([A-Z]{3})$/i);
|
|
90015
90068
|
if (match) {
|
|
@@ -91582,10 +91635,19 @@ function App() {
|
|
|
91582
91635
|
}
|
|
91583
91636
|
// Check if there's reasoning but no images (model might have failed)
|
|
91584
91637
|
if (message.reasoning_details && message.reasoning_details.length > 0) {
|
|
91638
|
+
logToTerminal('error', '❌ No images found in response. Model returned reasoning but no image was generated.');
|
|
91639
|
+
logToTerminal('error', '📋 Full response text:', responseText);
|
|
91640
|
+
logToTerminal('error', '📋 Parsed response data:', JSON.stringify(data, null, 2));
|
|
91641
|
+
logToTerminal('error', '📋 Message object:', JSON.stringify(message, null, 2));
|
|
91642
|
+
logToTerminal('error', '📋 Reasoning details:', JSON.stringify(message.reasoning_details, null, 2));
|
|
91585
91643
|
const reasoningError = new Error('No images found in response. Model returned reasoning but no image was generated.');
|
|
91586
91644
|
reasoningError.hasReasoning = true;
|
|
91587
91645
|
throw reasoningError;
|
|
91588
91646
|
}
|
|
91647
|
+
logToTerminal('error', '❌ No images found in response.');
|
|
91648
|
+
logToTerminal('error', '📋 Full response text:', responseText);
|
|
91649
|
+
logToTerminal('error', '📋 Parsed response data:', JSON.stringify(data, null, 2));
|
|
91650
|
+
logToTerminal('error', '📋 Message object:', JSON.stringify(message, null, 2));
|
|
91589
91651
|
throw new Error(`No images found in response. Message: ${JSON.stringify(message)}`);
|
|
91590
91652
|
}
|
|
91591
91653
|
// Images are returned as base64 data URLs: data:image/png;base64,...
|
|
@@ -92670,15 +92732,17 @@ function App() {
|
|
|
92670
92732
|
alert('Please fill in Product and Geo fields');
|
|
92671
92733
|
return;
|
|
92672
92734
|
}
|
|
92673
|
-
const { price: generatePrice, currency: generateCurrency } = parsePriceAndCurrency(generatePriceWithCurrency);
|
|
92735
|
+
const { price: generatePrice, currency: generateCurrency, currencySymbol } = parsePriceAndCurrency(generatePriceWithCurrency);
|
|
92674
92736
|
if (!generatePrice.trim() || !generateCurrency.trim()) {
|
|
92675
92737
|
logToTerminal('error', '❌ Missing price or currency');
|
|
92676
92738
|
alert('Please fill in Price field (format: "11400 HUF") for image generation');
|
|
92677
92739
|
return;
|
|
92678
92740
|
}
|
|
92741
|
+
// Use original currency symbol if available, otherwise use currency code
|
|
92742
|
+
const currencyForPrompt = currencySymbol || generateCurrency;
|
|
92679
92743
|
logToTerminal('log', '📦 Product:', generateProduct);
|
|
92680
92744
|
logToTerminal('log', '🌍 Geo:', generateGeo);
|
|
92681
|
-
logToTerminal('log', '💰 Price:', generatePrice,
|
|
92745
|
+
logToTerminal('log', '💰 Price:', generatePrice, currencyForPrompt);
|
|
92682
92746
|
if (!driveFolderUrl.trim()) {
|
|
92683
92747
|
logToTerminal('error', '❌ Missing Drive folder URL');
|
|
92684
92748
|
alert('Please fill in Google Drive Folder URL');
|
|
@@ -92713,7 +92777,8 @@ function App() {
|
|
|
92713
92777
|
// Base prompt structure
|
|
92714
92778
|
// NOTE: This generation prompt is intentionally STRICTER than the image validator (`validateCreativeImage`).
|
|
92715
92779
|
// Keep the prompt strict even if validator allows some "acceptable" deviations (e.g. 2-line headline, benefit headline, CTA position, discount emphasis).
|
|
92716
|
-
|
|
92780
|
+
// Use original currency symbol if available, otherwise use currency code
|
|
92781
|
+
const basePromptStructure = (0,_prompts__WEBPACK_IMPORTED_MODULE_1__.getImageGenerationBasePrompt)(generateGeo, generatePrice, currencyForPrompt);
|
|
92717
92782
|
// Generate 5 images with different approaches
|
|
92718
92783
|
const approaches = _prompts__WEBPACK_IMPORTED_MODULE_1__.CREO_APPROACHES;
|
|
92719
92784
|
// Initialize placeholders for 5 images
|
|
@@ -92905,10 +92970,12 @@ function App() {
|
|
|
92905
92970
|
errorMsg.includes('Failed to fetch') ||
|
|
92906
92971
|
errorMsg.includes('Network error') ||
|
|
92907
92972
|
errorMsg.includes('timeout') ||
|
|
92908
|
-
errorMsg.includes('Request timeout')
|
|
92973
|
+
errorMsg.includes('Request timeout') ||
|
|
92974
|
+
errorMsg.includes('Provider returned error') ||
|
|
92975
|
+
errorMsg.toLowerCase().includes('provider error'));
|
|
92909
92976
|
});
|
|
92910
92977
|
if (retryableErrors.length > 0) {
|
|
92911
|
-
addLog(formatLogMessage('log', `🔄 Повтор: найдено ${retryableErrors.length} ошибок (сеть/таймаут/JSON). Пробую ещё раз...`));
|
|
92978
|
+
addLog(formatLogMessage('log', `🔄 Повтор: найдено ${retryableErrors.length} ошибок (сеть/таймаут/JSON/Provider). Пробую ещё раз...`));
|
|
92912
92979
|
const retryIndices = retryableErrors.map(r => r.index).sort((a, b) => a - b);
|
|
92913
92980
|
let retryCursor = 0;
|
|
92914
92981
|
const retryWorkers = Array.from({ length: Math.min(maxParallel, retryIndices.length) }, () => (async () => {
|