e2b-dev / e2b-dev/code-interpreter

results.html generated HTML file has multiple issues

Aperta
#156 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug Code Interpreter
Lingua principale
Python
Stelle
2.4k
Fork
228
Merge medio
48m
PR unite (30g)
5

Descrizione

Issue: results.html generated HTML file has multiple issues
[1] It has only javascript content, no HTML container tags.
[2] The HTML file is so huge that it resolves CDN hosted javascript content instead of referring it.

The E2B code executed:

from dotenv import load_dotenv
load_dotenv()
from e2b_code_interpreter import Sandbox

api_key = E2B_API_KEY
code = "...."

sbx = Sandbox.create(api_key=api_key) 
execution = sbx.run_code(code)  

In [11]: execution.results
Out[11]: [Result(Formats: html), Result(Formats: html, application/vnd.plotly.v1+json)]

html_content = execution.results[0].html

In [12]: html_content
Out[12]: '        <script type="text/javascript">\n        window.PlotlyConfig = {MathJaxConfig: \'local\'};\n        if (window.MathJax && window.MathJax.Hub && window.MathJax.Hub.Config) {window.MathJax.Hub.Config({SVG: {font: "STIX-Web"}});}\n        </script>\n        <script type="module">/**\n* plotly.js v3.0.1\n* Copyright 2012-2025, Plotly, Inc.\n* All rights reserved.\n* Licensed under the MIT license\n*/\n(\n function(root, factory) {\n  if (typeof module === "object" && module.exports) {\n   module.exports = factory();\n  } else {\n   root.moduleName = factory();\n  }\n} (typeof self !== "undefined" ? self : this, () => {\n"use strict";var Plotly=(()=>{var VQe=Object.create;var MS=Object.defineProperty,HQe=Object.defineProperties,GQe=Object.getOwnPropertyDescriptor,jQe=Object.getOwnPropertyDescriptors,WQ
...
....
  • The above html_content shows only javascript content, no HTML container tags.
  • It has resolved and downloaded the entire CDN hosted plotly.js within it.

The expected HTML file should have reference to CDN hosted Plotly.js file

<html>
<head><meta charset="utf-8" /></head>
<body>
    <div>                        <script type="text/javascript">window.PlotlyConfig = {MathJaxConfig: 'local'};</script>
        <script charset="utf-8" src="https://cdn.plot.ly/plotly-2.35.2.min.js"></script>                <div id="f7c2c6fa-f9f3-40a5-a200-76f48ea8dd58" class="plotly-graph-div" style="height:100%; width:100%;"></div>            <script type="text/javascript">                                    window.PLOTLYENV=window.PLOTLYENV || {};                                    if (document.getElementById("f7c2c6fa-f9f3-40a5-a200-76f48ea8dd58")) {                    Plotly.newPlot(

References:

  • Plotly chart generation code is attached here: plotly-charts.py-
  • Expected HTML file content: top_10_gdp_pie_chart.html
  • Actual HTML file content from result.html: its huge 4 MB containing mainly plotly.js code

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con l’esempio allegato plotly-charts.py e traccia il percorso del risultato di Sandbox.run_code che produce results[0].html. Confrontalo con il top_10_gdp_pie_chart.html previsto; il lavoro è completato quando l’output include tag contenitore HTML e fa riferimento a Plotly.js ospitato su un CDN invece di incorporare l’intera libreria.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
javascript, plotly, python
Ambito
data-visualization
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
42/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.