From 5e2d68230ba5b6c7ee23ca1ab7c48efa3c5fd8cc Mon Sep 17 00:00:00 2001 From: Dan Chen Date: Thu, 21 Mar 2024 16:21:09 +0800 Subject: [PATCH] doc: Runtime readme.md --- runtime/READMD.md | 16 ++++++++++++++++ runtime/ast/runtime.py | 9 +-------- src/blackbox/tts.py | 2 -- 3 files changed, 17 insertions(+), 10 deletions(-) create mode 100644 runtime/READMD.md diff --git a/runtime/READMD.md b/runtime/READMD.md new file mode 100644 index 0000000..51ca1a9 --- /dev/null +++ b/runtime/READMD.md @@ -0,0 +1,16 @@ +# Runtime +一台VM運行時,用於隔離租戶環境與服務器環境,提供腿本用於調用模型流。 +# 語法 +``` +// 使用//註解 +// "雙引號字符串" +let s = "hello" +// 整數 +let i = 10 +// 浮點數 +let f = 1.2 +// 動態類型 +s = i +// 返回值 +return s +``` \ No newline at end of file diff --git a/runtime/ast/runtime.py b/runtime/ast/runtime.py index 8449e82..ce977ad 100644 --- a/runtime/ast/runtime.py +++ b/runtime/ast/runtime.py @@ -60,14 +60,7 @@ class Runtime: def variable_declaration(self, ast): id = ast.get("identifier").get("name") v = ast.get("value") - if self._is_literal(v): - l = self.literal(v) - if l != None: - self.records[id] = l - else: - raise Exception("Unknown literal type: " + v.get("type")) - if self._is_identifier(v): - self.records[id] = self.records.get(v.get("name")) + self.records[id] = self.unquote(v) def literal(self, ast): if ast.get("type") == "StringLiteral": diff --git a/src/blackbox/tts.py b/src/blackbox/tts.py index 68caa4d..f030692 100644 --- a/src/blackbox/tts.py +++ b/src/blackbox/tts.py @@ -1,11 +1,9 @@ import io -from typing import Any, Coroutine from fastapi import Request, Response, status from fastapi.responses import JSONResponse from .blackbox import Blackbox from tts.tts_service import TTService -import time class TTS(Blackbox):