krinlove commited on
Commit
e256f91
·
1 Parent(s): d3ff3ea
package.json CHANGED
@@ -52,7 +52,6 @@
52
  "@codemirror/lang-javascript": "^6.2.2",
53
  "@codemirror/lang-python": "^6.1.6",
54
  "@codemirror/theme-one-dark": "^6.1.2",
55
- "@codesandbox/sandpack-client": "^2.19.0",
56
  "@pyscript/core": "^0.4.32",
57
  "@sveltejs/adapter-node": "^2.0.0",
58
  "async": "^3.2.5",
 
52
  "@codemirror/lang-javascript": "^6.2.2",
53
  "@codemirror/lang-python": "^6.1.6",
54
  "@codemirror/theme-one-dark": "^6.1.2",
 
55
  "@pyscript/core": "^0.4.32",
56
  "@sveltejs/adapter-node": "^2.0.0",
57
  "async": "^3.2.5",
src/lib/components/chat/Messages/CodeBlock.svelte CHANGED
@@ -3,8 +3,6 @@
3
  import { loadPyodide } from 'pyodide';
4
  import mermaid from 'mermaid';
5
 
6
- import { loadSandpackClient } from '@codesandbox/sandpack-client';
7
-
8
  import { v4 as uuidv4 } from 'uuid';
9
 
10
  import { getContext, getAllContexts, onMount } from 'svelte';
@@ -215,37 +213,6 @@ __builtins__.input = input`);
215
  };
216
  };
217
 
218
- let sandpackIframe;
219
- let sandpackClient;
220
- const executeHTML = async (code) => {
221
- // Initialize Sandpack client
222
- const content = {
223
- files: {
224
- '/package.json': {
225
- code: JSON.stringify({
226
- main: 'index.html',
227
- devDependencies: {}
228
- })
229
- },
230
- '/index.html': { code }
231
- },
232
- environment: 'vanilla',
233
- template: 'static'
234
- };
235
- if (sandpackClient) {
236
- sandpackClient.updateSandbox(content);
237
- } else {
238
- sandpackClient = await loadSandpackClient(sandpackIframe, content, {
239
- showOpenInCodeSandbox: true
240
- });
241
- }
242
- };
243
- $: if (lang.toLowerCase() == 'php' || lang.toLowerCase() == 'html') {
244
- if (!!sandpackIframe) {
245
- executeHTML(code);
246
- }
247
- }
248
-
249
  let debounceTimeout;
250
 
251
  const drawMermaidDiagram = async () => {
@@ -352,18 +319,4 @@ __builtins__.input = input`);
352
  </div>
353
  {/if}
354
  {/if}
355
- {#if lang.toLowerCase() == 'php' || lang.toLowerCase() == 'html'}
356
- <div class="bg-[#202123] text-white px-4 py-4 rounded-b-lg">
357
- <div class="text-gray-500 text-xs mb-1 flex justify-between items-center">
358
- <span>HTML</span>
359
- <button
360
- class="copy-code-button bg-none border-none p-1"
361
- on:click={() => {
362
- executeHTML(code);
363
- }}>Refresh</button
364
- >
365
- </div>
366
- <iframe bind:this={sandpackIframe} title="HTML Preview" class="w-full h-96 mt-4 bg-white" />
367
- </div>
368
- {/if}
369
  </div>
 
3
  import { loadPyodide } from 'pyodide';
4
  import mermaid from 'mermaid';
5
 
 
 
6
  import { v4 as uuidv4 } from 'uuid';
7
 
8
  import { getContext, getAllContexts, onMount } from 'svelte';
 
213
  };
214
  };
215
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
216
  let debounceTimeout;
217
 
218
  const drawMermaidDiagram = async () => {
 
319
  </div>
320
  {/if}
321
  {/if}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
322
  </div>