zerochat 7.3.0__py3-none-any.whl
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.
- zerochat-7.3.0.dist-info/METADATA +70 -0
- zerochat-7.3.0.dist-info/RECORD +130 -0
- zerochat-7.3.0.dist-info/WHEEL +5 -0
- zerochat-7.3.0.dist-info/entry_points.txt +2 -0
- zerochat-7.3.0.dist-info/licenses/LICENSE +34 -0
- zerochat-7.3.0.dist-info/top_level.txt +2 -0
- zerochat.py +2004 -0
- zerochat_runtime/__init__.py +1 -0
- zerochat_runtime/assets/css/base.css +199 -0
- zerochat_runtime/assets/css/components/composer.css +1258 -0
- zerochat_runtime/assets/css/components/debug.css +777 -0
- zerochat_runtime/assets/css/components/header.css +97 -0
- zerochat_runtime/assets/css/components/icons.css +39 -0
- zerochat_runtime/assets/css/components/markdown.css +685 -0
- zerochat_runtime/assets/css/components/messages.css +473 -0
- zerochat_runtime/assets/css/components/modals.css +1319 -0
- zerochat_runtime/assets/css/components/sidebar.css +622 -0
- zerochat_runtime/assets/css/components/tools.css +1223 -0
- zerochat_runtime/assets/css/layout.css +171 -0
- zerochat_runtime/assets/css/print.css +120 -0
- zerochat_runtime/assets/css/styles.css +18 -0
- zerochat_runtime/assets/css/theme-overrides.css +555 -0
- zerochat_runtime/assets/css/tokens.css +165 -0
- zerochat_runtime/assets/help/architecture.html +247 -0
- zerochat_runtime/assets/help/composer.html +134 -0
- zerochat_runtime/assets/help/conversations.html +105 -0
- zerochat_runtime/assets/help/debug.html +108 -0
- zerochat_runtime/assets/help/en/architecture.html +247 -0
- zerochat_runtime/assets/help/en/composer.html +134 -0
- zerochat_runtime/assets/help/en/conversations.html +104 -0
- zerochat_runtime/assets/help/en/debug.html +105 -0
- zerochat_runtime/assets/help/en/gemini-free.html +39 -0
- zerochat_runtime/assets/help/en/index.html +191 -0
- zerochat_runtime/assets/help/en/learning.html +71 -0
- zerochat_runtime/assets/help/en/mcp.html +143 -0
- zerochat_runtime/assets/help/en/openrouter-free.html +39 -0
- zerochat_runtime/assets/help/en/profiles.html +173 -0
- zerochat_runtime/assets/help/en/rag.html +130 -0
- zerochat_runtime/assets/help/en/reasoning-telemetry.html +108 -0
- zerochat_runtime/assets/help/en/tools-agent.html +133 -0
- zerochat_runtime/assets/help/en/webllm.html +355 -0
- zerochat_runtime/assets/help/gemini-free.html +39 -0
- zerochat_runtime/assets/help/help.css +604 -0
- zerochat_runtime/assets/help/help.js +51 -0
- zerochat_runtime/assets/help/index.html +194 -0
- zerochat_runtime/assets/help/learning.html +71 -0
- zerochat_runtime/assets/help/mcp.html +143 -0
- zerochat_runtime/assets/help/openrouter-free.html +39 -0
- zerochat_runtime/assets/help/profiles.html +174 -0
- zerochat_runtime/assets/help/rag.html +130 -0
- zerochat_runtime/assets/help/reasoning-telemetry.html +111 -0
- zerochat_runtime/assets/help/tools-agent.html +133 -0
- zerochat_runtime/assets/help/webllm.html +359 -0
- zerochat_runtime/assets/js/agent-core.js +1553 -0
- zerochat_runtime/assets/js/api.js +844 -0
- zerochat_runtime/assets/js/app.js +2558 -0
- zerochat_runtime/assets/js/attachments.js +220 -0
- zerochat_runtime/assets/js/charts.js +338 -0
- zerochat_runtime/assets/js/chat-engine.js +566 -0
- zerochat_runtime/assets/js/config-store.js +207 -0
- zerochat_runtime/assets/js/context-manager.js +584 -0
- zerochat_runtime/assets/js/conversation-service.js +484 -0
- zerochat_runtime/assets/js/cookies.js +688 -0
- zerochat_runtime/assets/js/data-reset-service.js +136 -0
- zerochat_runtime/assets/js/debug.js +508 -0
- zerochat_runtime/assets/js/defaults.js +16 -0
- zerochat_runtime/assets/js/export.js +179 -0
- zerochat_runtime/assets/js/file-parser.js +2088 -0
- zerochat_runtime/assets/js/generation-controller.js +417 -0
- zerochat_runtime/assets/js/i18n.js +1483 -0
- zerochat_runtime/assets/js/icons.js +156 -0
- zerochat_runtime/assets/js/ingestionEngine.js +436 -0
- zerochat_runtime/assets/js/markdown.js +588 -0
- zerochat_runtime/assets/js/mcp.js +1271 -0
- zerochat_runtime/assets/js/message-turns.js +62 -0
- zerochat_runtime/assets/js/profile-backup.js +118 -0
- zerochat_runtime/assets/js/profile-export-bundle.js +481 -0
- zerochat_runtime/assets/js/profile-repository.js +213 -0
- zerochat_runtime/assets/js/providers-webllm.js +486 -0
- zerochat_runtime/assets/js/providers.js +1560 -0
- zerochat_runtime/assets/js/rag-index.js +295 -0
- zerochat_runtime/assets/js/rag-service.js +530 -0
- zerochat_runtime/assets/js/rag-ui.js +997 -0
- zerochat_runtime/assets/js/ragStorage.js +676 -0
- zerochat_runtime/assets/js/sandbox.js +449 -0
- zerochat_runtime/assets/js/state.js +704 -0
- zerochat_runtime/assets/js/storage-db.js +144 -0
- zerochat_runtime/assets/js/tool-cards.js +330 -0
- zerochat_runtime/assets/js/tool-security.js +653 -0
- zerochat_runtime/assets/js/tools/README.md +50 -0
- zerochat_runtime/assets/js/tools/builtin/agent-checkpoint.tool.js +212 -0
- zerochat_runtime/assets/js/tools/builtin/download-pdf.tool.js +111 -0
- zerochat_runtime/assets/js/tools/builtin/execute-javascript.tool.js +219 -0
- zerochat_runtime/assets/js/tools/builtin/fetch-web-page.tool.js +112 -0
- zerochat_runtime/assets/js/tools/builtin/list-documents.tool.js +117 -0
- zerochat_runtime/assets/js/tools/builtin/read-knowledge-chunk.tool.js +129 -0
- zerochat_runtime/assets/js/tools/builtin/read-knowledge-image.tool.js +95 -0
- zerochat_runtime/assets/js/tools/builtin/render-chart.tool.js +90 -0
- zerochat_runtime/assets/js/tools/builtin/search-knowledge-base.tool.js +124 -0
- zerochat_runtime/assets/js/tools/builtin/search-web.tool.js +125 -0
- zerochat_runtime/assets/js/tools/tool-manifest.js +53 -0
- zerochat_runtime/assets/js/tools/tool-runtime.js +77 -0
- zerochat_runtime/assets/js/ui-composer.js +319 -0
- zerochat_runtime/assets/js/ui-conversation.js +655 -0
- zerochat_runtime/assets/js/ui-dialogs.js +132 -0
- zerochat_runtime/assets/js/ui-generation-status.js +119 -0
- zerochat_runtime/assets/js/ui-inspector.js +804 -0
- zerochat_runtime/assets/js/ui-mcp.js +604 -0
- zerochat_runtime/assets/js/ui-profiles.js +824 -0
- zerochat_runtime/assets/js/ui-reasoning.js +146 -0
- zerochat_runtime/assets/js/ui-settings.js +825 -0
- zerochat_runtime/assets/js/ui-shell.js +215 -0
- zerochat_runtime/assets/js/ui-sidebar.js +429 -0
- zerochat_runtime/assets/js/ui-telemetry.js +404 -0
- zerochat_runtime/assets/js/ui-transfer.js +262 -0
- zerochat_runtime/assets/js/utils.js +216 -0
- zerochat_runtime/assets/js/vendor/orama.browser.js +11 -0
- zerochat_runtime/assets/js/web-browser.js +569 -0
- zerochat_runtime/assets/js/web-search.js +519 -0
- zerochat_runtime/assets/manifest.webmanifest +20 -0
- zerochat_runtime/assets/services/dummy_mcp/dummy_mcp_server.py +47 -0
- zerochat_runtime/assets/services/dummy_mcp/service.json +22 -0
- zerochat_runtime/assets/services/lsp/installer.json +9 -0
- zerochat_runtime/assets/services/lsp/service.json +22 -0
- zerochat_runtime/assets/services/memory/installer.json +9 -0
- zerochat_runtime/assets/services/memory/service.json +24 -0
- zerochat_runtime/assets/services/playwright/installer.json +10 -0
- zerochat_runtime/assets/services/playwright/service.json +39 -0
- zerochat_runtime/assets/sw.js +164 -0
- zerochat_runtime/assets/zerochat.html +671 -0
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* M贸dulo de Exportaci贸n e Importaci贸n (ChatExport) para ZeroChat.
|
|
3
|
+
* Gestiona la serializaci贸n a Markdown, JSON estructurado, impresi贸n y parseo de archivos importados.
|
|
4
|
+
*/
|
|
5
|
+
(function (root, factory) {
|
|
6
|
+
if (typeof exports === 'object' && typeof module !== 'undefined') {
|
|
7
|
+
module.exports = factory();
|
|
8
|
+
} else {
|
|
9
|
+
root.ChatExport = factory();
|
|
10
|
+
}
|
|
11
|
+
}(typeof self !== 'undefined' ? self : this, function () {
|
|
12
|
+
'use strict';
|
|
13
|
+
|
|
14
|
+
function downloadFile(content, filename, mimeType) {
|
|
15
|
+
if (typeof document === 'undefined' || typeof URL === 'undefined') return false;
|
|
16
|
+
try {
|
|
17
|
+
const blob = new Blob([content], { type: mimeType });
|
|
18
|
+
const url = URL.createObjectURL(blob);
|
|
19
|
+
const a = document.createElement('a');
|
|
20
|
+
a.href = url;
|
|
21
|
+
a.download = filename;
|
|
22
|
+
document.body.appendChild(a);
|
|
23
|
+
a.click();
|
|
24
|
+
document.body.removeChild(a);
|
|
25
|
+
URL.revokeObjectURL(url);
|
|
26
|
+
return true;
|
|
27
|
+
} catch (e) {
|
|
28
|
+
console.error('ChatExport: Error al descargar archivo:', e);
|
|
29
|
+
return false;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function buildMarkdownExport(chatHistory, options = {}) {
|
|
34
|
+
const title = options.title || 'ZeroChat_Conversation';
|
|
35
|
+
const model = options.model || (options.t ? options.t('not_specified') : 'No especificado');
|
|
36
|
+
const dateStr = options.date || new Date().toLocaleString();
|
|
37
|
+
const userRole = options.userRole || (options.t ? options.t('role_user') : '馃懁 Usuario');
|
|
38
|
+
const assistantRole = options.assistantRole || (options.t ? options.t('role_assistant') : '馃 Asistente');
|
|
39
|
+
const exportDateLabel = options.exportDateLabel || (options.t ? options.t('export_date') : 'Fecha de exportaci贸n');
|
|
40
|
+
const modelLabel = options.modelLabel || (options.t ? options.t('field_model') : 'Modelo');
|
|
41
|
+
|
|
42
|
+
let md = `# ${title}\n\n*${exportDateLabel}: ${dateStr}*\n*${modelLabel}: ${model}*\n\n---\n\n`;
|
|
43
|
+
|
|
44
|
+
(chatHistory || []).forEach(m => {
|
|
45
|
+
if (!m || m.role === 'system') return;
|
|
46
|
+
if (m.role === 'user') {
|
|
47
|
+
const contentStr = typeof m.content === 'string' ? m.content : JSON.stringify(m.content);
|
|
48
|
+
md += `### ${userRole}\n\n${contentStr}\n\n---\n\n`;
|
|
49
|
+
} else if (m.role === 'assistant' && m.content) {
|
|
50
|
+
md += `### ${assistantRole}\n\n${m.content}\n\n---\n\n`;
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
return md;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function buildJsonExport(sessionMeta = {}, chatHistory = [], appConfig = {}) {
|
|
58
|
+
const title = sessionMeta.title || 'ZeroChat_Conversation';
|
|
59
|
+
const exportData = {
|
|
60
|
+
version: '5.1',
|
|
61
|
+
app: 'ZeroChat',
|
|
62
|
+
exportedAt: new Date().toISOString(),
|
|
63
|
+
session: {
|
|
64
|
+
id: sessionMeta.id || ('session_' + Date.now()),
|
|
65
|
+
title: title,
|
|
66
|
+
createdAt: sessionMeta.createdAt || Date.now(),
|
|
67
|
+
updatedAt: Date.now(),
|
|
68
|
+
history: chatHistory
|
|
69
|
+
},
|
|
70
|
+
config: {
|
|
71
|
+
model: appConfig.model || '',
|
|
72
|
+
apiUrl: appConfig.apiUrl || '',
|
|
73
|
+
apiType: appConfig.apiType || ''
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
return JSON.stringify(exportData, null, 2);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function parseImportedJson(jsonString, defaultTitle = 'Conversaci贸n Importada') {
|
|
80
|
+
if (!jsonString || typeof jsonString !== 'string') {
|
|
81
|
+
throw new Error('El contenido proporcionado no es una cadena JSON v谩lida.');
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
const data = JSON.parse(jsonString);
|
|
85
|
+
const importedSession = data.session || data;
|
|
86
|
+
|
|
87
|
+
if (!importedSession || !Array.isArray(importedSession.history)) {
|
|
88
|
+
throw new Error('El archivo no contiene un historial de chat v谩lido (propiedad history ausente).');
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const newId = 'session_' + Date.now() + '_' + Math.random().toString(36).slice(2, 7);
|
|
92
|
+
return {
|
|
93
|
+
id: newId,
|
|
94
|
+
title: importedSession.title || defaultTitle,
|
|
95
|
+
createdAt: importedSession.createdAt || Date.now(),
|
|
96
|
+
updatedAt: Date.now(),
|
|
97
|
+
history: importedSession.history
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
function getExportModalHTML() {
|
|
102
|
+
return `<div class="modal-card">
|
|
103
|
+
<div class="modal-header">
|
|
104
|
+
<div class="modal-title">
|
|
105
|
+
<span class="modal-icon">
|
|
106
|
+
<svg class="ui-icon" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor"><use href="#icon-download"></use></svg>
|
|
107
|
+
</span>
|
|
108
|
+
<h3 data-i18n="export_modal_title">Exportar Conversaci贸n</h3>
|
|
109
|
+
</div>
|
|
110
|
+
<button type="button" id="btn-close-export" class="btn-close-modal" data-i18n-title="btn_close_export_title" title="Cerrar modal">
|
|
111
|
+
<svg class="ui-icon" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor"><use href="#icon-close"></use></svg>
|
|
112
|
+
</button>
|
|
113
|
+
</div>
|
|
114
|
+
|
|
115
|
+
<div class="modal-body-scrollable">
|
|
116
|
+
<div class="export-options-grid">
|
|
117
|
+
<button type="button" id="btn-export-markdown" class="export-card-btn">
|
|
118
|
+
<span class="export-card-icon">
|
|
119
|
+
<svg class="ui-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor"><use href="#icon-file-text"></use></svg>
|
|
120
|
+
</span>
|
|
121
|
+
<div class="export-card-info">
|
|
122
|
+
<strong data-i18n="export_md_title">Descargar Markdown (.md)</strong>
|
|
123
|
+
<span data-i18n="export_md_desc">Formato limpio con formato, c贸digo y tablas legible en cualquier visor.</span>
|
|
124
|
+
</div>
|
|
125
|
+
</button>
|
|
126
|
+
|
|
127
|
+
<button type="button" id="btn-export-json" class="export-card-btn">
|
|
128
|
+
<span class="export-card-icon">
|
|
129
|
+
<svg class="ui-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor"><use href="#icon-code"></use></svg>
|
|
130
|
+
</span>
|
|
131
|
+
<div class="export-card-info">
|
|
132
|
+
<strong data-i18n="export_json_title">Descargar JSON de Sesi贸n (.json)</strong>
|
|
133
|
+
<span data-i18n="export_json_desc">Historial estructurado completo con herramientas, im谩genes y metadatos para restaurar.</span>
|
|
134
|
+
</div>
|
|
135
|
+
</button>
|
|
136
|
+
|
|
137
|
+
<button type="button" id="btn-export-print" class="export-card-btn">
|
|
138
|
+
<span class="export-card-icon">
|
|
139
|
+
<svg class="ui-icon" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor"><use href="#icon-printer"></use></svg>
|
|
140
|
+
</span>
|
|
141
|
+
<div class="export-card-info">
|
|
142
|
+
<strong data-i18n="export_pdf_title">Imprimir / Guardar como PDF</strong>
|
|
143
|
+
<span data-i18n="export_pdf_desc">Genera un documento PDF limpio maquetado para lectura e informes.</span>
|
|
144
|
+
</div>
|
|
145
|
+
</button>
|
|
146
|
+
</div>
|
|
147
|
+
</div>
|
|
148
|
+
|
|
149
|
+
<div class="modal-footer">
|
|
150
|
+
<button type="button" id="btn-cancel-export" class="btn-secondary" data-i18n="btn_close">Cerrar</button>
|
|
151
|
+
</div>
|
|
152
|
+
</div>`;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function ensureDialogMarkup() {
|
|
156
|
+
if (typeof document === 'undefined') return;
|
|
157
|
+
const dialog = document.getElementById('export-modal');
|
|
158
|
+
if (dialog && !dialog.firstElementChild) {
|
|
159
|
+
dialog.innerHTML = getExportModalHTML();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (typeof document !== 'undefined') {
|
|
164
|
+
if (document.readyState === 'loading') {
|
|
165
|
+
document.addEventListener('DOMContentLoaded', ensureDialogMarkup);
|
|
166
|
+
} else {
|
|
167
|
+
ensureDialogMarkup();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return {
|
|
172
|
+
downloadFile,
|
|
173
|
+
buildMarkdownExport,
|
|
174
|
+
buildJsonExport,
|
|
175
|
+
parseImportedJson,
|
|
176
|
+
ensureDialogMarkup,
|
|
177
|
+
getExportModalHTML
|
|
178
|
+
};
|
|
179
|
+
}));
|