build(boards): 所有板卡执行 npm run build:prod

This commit is contained in:
王立帮
2025-04-22 01:55:29 +08:00
parent a1bfd806fa
commit c09fd8eca5
60 changed files with 122 additions and 55 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
<script defer=defer src=main.bundle.js></script><link href=styles/main.b29a8ee0.css rel=stylesheet><xml></xml>
<script defer=defer src=main.bundle.484e98a9.js></script><link href=styles/main.b29a8ee0.css rel=stylesheet><xml></xml>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -605,7 +605,7 @@
"json"
],
"__file__": true,
"__size__": 3362,
"__size__": 3412,
"__name__": "ollama.py"
},
"onenet": {
@@ -617,6 +617,17 @@
"__size__": 1102,
"__name__": "onenet.py"
},
"openai": {
"__require__": [
"urequests",
"time",
"json",
"ollama"
],
"__file__": true,
"__size__": 1772,
"__name__": "openai.py"
},
"pe_g1": {
"__require__": [
"time",

View File

@@ -4,7 +4,7 @@ import json
class Ollama():
def __init__(self, url="", model="", max_history_num=0):
def __init__(self, url="", model="", max_history_num=0, max_tokens=1024):
self._heads = {
"Accept": "text/event-stream",
# "Cache-Control": "no-cache",
@@ -19,7 +19,8 @@ class Ollama():
self._data = {
"stream": True,
"model": model,
"messages": self._messages
"messages": self._messages,
"max_tokens": max_tokens
}
def set_timeout(self, timeout):
@@ -60,7 +61,7 @@ class Ollama():
self._url, headers=self._heads, data=data)
if response.status_code == 200:
break
time.slee(1)
time.sleep(1)
output = ""
@@ -101,7 +102,7 @@ class Ollama():
self.add_history("assistant", content)
messages_len = len(self._messages)
history_num = 2 * self._max_history_num
while history_num < len(self._messages):
while history_num < messages_len:
del self._messages[0]
else:
self.clear_user_history()

View File

@@ -0,0 +1,53 @@
import urequests
import time
import json
import ollama
class OpenAI(ollama.Ollama):
def __init__(self, url="", api_key="", model="", max_history_num=0, max_tokens=1024):
super().__init__(url, model, max_history_num)
self._heads["Authorization"] = "Bearer {}".format(api_key)
self._data["max_tokens"] = max_tokens
self._chat_url = "{}/chat/completions".format(self._url)
def _post(self, content_callback=None):
response = None
data = json.dumps(self._data).encode('utf-8')
for i in range(0, self._max_retries):
response = urequests.post(
self._chat_url, headers=self._heads, data=data)
if response.status_code == 200:
break
time.sleep(1)
output = ""
if response.status_code != 200:
output = response.text
if content_callback:
content_callback(output)
return output
if not content_callback:
output = json.loads(response.text)[
"choices"][0]["message"]["content"]
response.close()
return output
try:
while True:
line = response.raw.readline()
if line[:5] != b"data:":
continue
if line[-7:-1] == b"[DONE]":
break
line = line[6:-1]
line = line.decode('utf-8').strip()
data = json.loads(line)
content = data["choices"][0]["delta"]["content"]
content_callback(content)
output += content
finally:
response.close()
return output

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1 +1 @@
<xml version="Mixly 3.0 rc0" board="Python ESP32-C2@MixGo MINI" shown="block"><block type="serial_softserial_new" id="}-8I=}Oy/^$xZ2~x4kL!" x="0" y="0"><field name="mode">1</field><field name="baudrate">115200</field><value name="RX"><shadow type="pins_digital_pin" id=":Ii}0L=tKl,[vdo;dHh9"><field name="PIN">1</field></shadow></value><value name="TX"><shadow type="pins_digital_pin" id="1zPdASSAo6-eS;CmX+w|"><field name="PIN">2</field></shadow></value><next><block type="ai_sensor_use_uart_init" id="zI8V3T|CyFZ1MIXLnwh9"><field name="key">uart1</field><value name="SUB"><shadow type="variables_get" id="k#RrYE#r?H|W=GI)l!0n"><field name="VAR">ai_sensor</field></shadow></value><next><block type="ai_sensor_config" id="WU0dJ}mDBqjC1^Ih!3{I"><field name="mode">True</field><value name="SUB"><shadow type="variables_get" id="`#P@::m{0.[~pJx_AxpF"><field name="VAR">ai_sensor</field></shadow></value><value name="RX"><shadow type="math_number" id="gCo6Z=T;GK1VgNOqEz8-"><field name="NUM">9</field></shadow></value><value name="TX"><shadow type="math_number" id="s|n3]k[)hC`dt3G;0|.]"><field name="NUM">8</field></shadow></value><next><block type="controls_whileUntil" id="H.2bFX3`72[4QwV.Rd*$"><field name="MODE">WHILE</field><value name="BOOL"><shadow type="logic_boolean" id="H5~!OR`7?48h}`3{_+)A"><field name="BOOL">TRUE</field></shadow></value><statement name="DO"><block type="variables_set" id="6aDP.lFiPsE0:GG/]:{i"><field name="VAR">info</field><value name="VALUE"><block type="ai_sensor_find_qrcodes" id=".JkE(#sMT).uY@wl#.i3"><value name="SUB"><shadow type="variables_get" id="7Iz|R_i5EZaQMCQ]Gsn["><field name="VAR">ai_sensor</field></shadow></value></block></value><next><block type="controls_forEach" id="hFhR8hV7n[)y.TugsuRU"><value name="LIST"><shadow type="list_many_input" id="Hf2q+Z238kPm+(R9@#jR"><field name="CONTENT">0,1,2,3</field></shadow><block type="variables_get" id="XO:K8o?UZiMYD8K.nu4D"><field name="VAR">info</field></block></value><value name="VAR"><shadow type="variables_get" id="(4WgD/2*uwh|S29q#-n="><field name="VAR">i</field></shadow><block type="variables_get" id="i_ucg]p-E{,qTSbNL/~c"><field name="VAR">qrcode</field></block></value><statement name="DO"><block type="variables_set" id="w3z[5BdTII((!N*6,CKR"><field name="VAR">qrneirong</field><value name="VALUE"><block type="ai_sensor_qrcode" id="i!mqP24D_:]o.VspA)p7"><field name="key">info1</field><value name="VAR"><shadow type="variables_get" id="cBFq3^~jxP7e2_U0IqGw"><field name="VAR">qrcode</field></shadow></value></block></value><next><block type="display_scroll_string" id="BhU713,+!^RwT$NhAPQ2"><value name="data"><shadow type="text" id=":_j|I7:u9MRoS7ztvJ]!"><field name="TEXT">Mixly</field></shadow><block type="variables_get" id="WQT-P-HYuK923p=Fz/ae"><field name="VAR">qrneirong</field></block></value></block></next></block></statement><next><block type="controls_delay_new" id="4IpVTMV])ksiX3Mn`1hP"><field name="Time">s</field><value name="DELAY_TIME"><shadow type="math_number" id="rky4`N0r+sU+Pv}A37``"><field name="NUM">0.1</field></shadow></value></block></next></block></next></block></statement></block></next></block></next></block></next></block></xml><config>{}</config><code>aW1wb3J0IG1hY2hpbmUKaW1wb3J0IG1peGdvX2FpCmZyb20gbWl4Z29fbWluaSBpbXBvcnQgb25ib2FyZF9tYXRyaXgKaW1wb3J0IHRpbWUKCgp1YXJ0MT1tYWNoaW5lLlVBUlQoMSwgdHg9Miwgcng9MSwgYmF1ZHJhdGU9MTE1MjAwKQphaV9zZW5zb3I9bWl4Z29fYWkuQUkodWFydDEsIHF1aWNrPTEpCmFpX3NlbnNvci5jb25maWd1cmUoOCwgOSwgcmVzdGFydD1UcnVlKQp3aGlsZSBUcnVlOgogICAgaW5mbyA9IGFpX3NlbnNvci5maW5kX3FyY29kZXMoKQogICAgZm9yIHFyY29kZSBpbiBpbmZvOgogICAgICAgIHFybmVpcm9uZyA9IHFyY29kZS5pbmZvMQogICAgICAgIG9uYm9hcmRfbWF0cml4LnNjcm9sbChxcm5laXJvbmcpCiAgICB0aW1lLnNsZWVwKDAuMSkK</code>
<xml version="Mixly 3.0 rc0" board="Python ESP32-C2@MixGo MINI" shown="block"><block type="serial_softserial_new" id="D!0]~AEaPovQiN;-9,m," x="0" y="0"><field name="mode">1</field><field name="baudrate">115200</field><value name="RX"><shadow type="pins_digital_pin" id="uepTzB1hEQv.CJp}9jbe"><field name="PIN">1</field></shadow></value><value name="TX"><shadow type="pins_digital_pin" id=".9Pw}yMpOYkSE^*ds=~S"><field name="PIN">2</field></shadow></value><next><block type="ai_sensor_use_uart_init" id="c5Vy(g*:S)f5X,T0-841"><field name="key">uart1</field><value name="SUB"><shadow type="variables_get" id="m|?9ZfgW6N40PMzxF,W;"><field name="VAR">ai_sensor</field></shadow></value><next><block type="ai_sensor_config" id="[R+6/5YSosKoi-bUFtf5"><field name="mode">True</field><value name="SUB"><shadow type="variables_get" id="`zvd~[0.ve]vw4`EX=OQ"><field name="VAR">ai_sensor</field></shadow></value><value name="RX"><shadow type="math_number" id="#QOM_z?ZRipW=5_R5v2)"><field name="NUM">9</field></shadow></value><value name="TX"><shadow type="math_number" id="*OPPiwjB)9;*vUkFu8-["><field name="NUM">8</field></shadow></value><next><block type="controls_whileUntil" id="fTZw*rl|49I_1y/0?8l|"><field name="MODE">WHILE</field><value name="BOOL"><shadow type="logic_boolean" id="D^!ipj+QLhr*]0lv#Uop"><field name="BOOL">TRUE</field></shadow></value><statement name="DO"><block type="variables_set" id="1f)/(f2t9utM~@vVC#!`"><field name="VAR">info</field><value name="VALUE"><block type="ai_sensor_classifier_faces" id="+_hhR;-[/HIJM#Fwh$;^"><value name="SUB"><shadow type="variables_get" id="r4TlM0W6?r]*8n]CSy4C"><field name="VAR">ai_sensor</field></shadow></value></block></value><next><block type="controls_forEach" id="2iM;vW:G{G}DrJrz{*G3"><value name="LIST"><shadow type="list_many_input" id="JxS5iv(E8htF8sse_i,F"><field name="CONTENT">0,1,2,3</field></shadow><block type="variables_get" id="[T!H`KgRo?l9]v:TUTJ-"><field name="VAR">info</field></block></value><value name="VAR"><shadow type="variables_get" id="XPAVM`zBJrb/Dozc-W{j"><field name="VAR">i</field></shadow><block type="variables_get" id="sjL7Nc3/90HT{~]bx2h1"><field name="VAR">face</field></block></value><statement name="DO"><block type="variables_set" id="4Uk6PCK3Tb:PI}xWRfiG"><field name="VAR">people</field><value name="VALUE"><block type="ai_sensor_face" id="oK37k+z1t^ycpJ1$xKQ}"><field name="key">info1</field><value name="VAR"><shadow type="variables_get" id="DL?LIAl+BM=W?l]TO=j:"><field name="VAR">face</field></shadow></value></block></value><next><block type="display_scroll_string" id="}F^`o/R.hFGUD{X?:v[2"><value name="data"><shadow type="text" id=",-W!SLRD!Dn/$#J/de.Y"><field name="TEXT">Mixly</field></shadow><block type="variables_get" id="cuDc4jOxbV!~nBRi(zP6"><field name="VAR">people</field></block></value></block></next></block></statement><next><block type="controls_delay_new" id="AH=Gb!^{_q!MiMPO#knX"><field name="Time">s</field><value name="DELAY_TIME"><shadow type="math_number" id="R7/8IU8jY,Ilv4WwXdm/"><field name="NUM">0.1</field></shadow></value></block></next></block></next></block></statement></block></next></block></next></block></next></block></xml><config>{}</config><code>aW1wb3J0IG1hY2hpbmUKaW1wb3J0IG1peGdvX2FpCmZyb20gbWl4Z29fbWluaSBpbXBvcnQgb25ib2FyZF9tYXRyaXgKaW1wb3J0IHRpbWUKCgp1YXJ0MT1tYWNoaW5lLlVBUlQoMSwgdHg9Miwgcng9MSwgYmF1ZHJhdGU9MTE1MjAwKQphaV9zZW5zb3I9bWl4Z29fYWkuQUkodWFydDEsIHF1aWNrPTEpCmFpX3NlbnNvci5jb25maWd1cmUoOCwgOSwgcmVzdGFydD1UcnVlKQp3aGlsZSBUcnVlOgogICAgaW5mbyA9IGFpX3NlbnNvci5mYWNlX2RldGVjdCgpCiAgICBmb3IgZmFjZSBpbiBpbmZvOgogICAgICAgIHBlb3BsZSA9IGZhY2UuaW5mbzEKICAgICAgICBvbmJvYXJkX21hdHJpeC5zY3JvbGwocGVvcGxlKQogICAgdGltZS5zbGVlcCgwLjEpCg==</code>sZWVwKDAuMSkK</code>

View File

@@ -1 +0,0 @@
<xml version="Mixly 3.0 rc0" board="Python ESP32-C2@MixGo MINI" shown="block"><block type="serial_softserial_new" id="D!0]~AEaPovQiN;-9,m," x="0" y="0"><field name="mode">1</field><field name="baudrate">115200</field><value name="RX"><shadow type="pins_digital_pin" id="uepTzB1hEQv.CJp}9jbe"><field name="PIN">1</field></shadow></value><value name="TX"><shadow type="pins_digital_pin" id=".9Pw}yMpOYkSE^*ds=~S"><field name="PIN">2</field></shadow></value><next><block type="ai_sensor_use_uart_init" id="c5Vy(g*:S)f5X,T0-841"><field name="key">uart1</field><value name="SUB"><shadow type="variables_get" id="m|?9ZfgW6N40PMzxF,W;"><field name="VAR">ai_sensor</field></shadow></value><next><block type="ai_sensor_config" id="[R+6/5YSosKoi-bUFtf5"><field name="mode">True</field><value name="SUB"><shadow type="variables_get" id="`zvd~[0.ve]vw4`EX=OQ"><field name="VAR">ai_sensor</field></shadow></value><value name="RX"><shadow type="math_number" id="#QOM_z?ZRipW=5_R5v2)"><field name="NUM">9</field></shadow></value><value name="TX"><shadow type="math_number" id="*OPPiwjB)9;*vUkFu8-["><field name="NUM">8</field></shadow></value><next><block type="controls_whileUntil" id="fTZw*rl|49I_1y/0?8l|"><field name="MODE">WHILE</field><value name="BOOL"><shadow type="logic_boolean" id="D^!ipj+QLhr*]0lv#Uop"><field name="BOOL">TRUE</field></shadow></value><statement name="DO"><block type="variables_set" id="1f)/(f2t9utM~@vVC#!`"><field name="VAR">info</field><value name="VALUE"><block type="ai_sensor_classifier_faces" id="+_hhR;-[/HIJM#Fwh$;^"><value name="SUB"><shadow type="variables_get" id="r4TlM0W6?r]*8n]CSy4C"><field name="VAR">ai_sensor</field></shadow></value></block></value><next><block type="controls_forEach" id="2iM;vW:G{G}DrJrz{*G3"><value name="LIST"><shadow type="list_many_input" id="JxS5iv(E8htF8sse_i,F"><field name="CONTENT">0,1,2,3</field></shadow><block type="variables_get" id="[T!H`KgRo?l9]v:TUTJ-"><field name="VAR">info</field></block></value><value name="VAR"><shadow type="variables_get" id="XPAVM`zBJrb/Dozc-W{j"><field name="VAR">i</field></shadow><block type="variables_get" id="sjL7Nc3/90HT{~]bx2h1"><field name="VAR">face</field></block></value><statement name="DO"><block type="variables_set" id="4Uk6PCK3Tb:PI}xWRfiG"><field name="VAR">people</field><value name="VALUE"><block type="ai_sensor_face" id="oK37k+z1t^ycpJ1$xKQ}"><field name="key">info1</field><value name="VAR"><shadow type="variables_get" id="DL?LIAl+BM=W?l]TO=j:"><field name="VAR">face</field></shadow></value></block></value><next><block type="display_scroll_string" id="}F^`o/R.hFGUD{X?:v[2"><value name="data"><shadow type="text" id=",-W!SLRD!Dn/$#J/de.Y"><field name="TEXT">Mixly</field></shadow><block type="variables_get" id="cuDc4jOxbV!~nBRi(zP6"><field name="VAR">people</field></block></value></block></next></block></statement><next><block type="controls_delay_new" id="AH=Gb!^{_q!MiMPO#knX"><field name="Time">s</field><value name="DELAY_TIME"><shadow type="math_number" id="R7/8IU8jY,Ilv4WwXdm/"><field name="NUM">0.1</field></shadow></value></block></next></block></next></block></statement></block></next></block></next></block></next></block></xml><config>{}</config><code>aW1wb3J0IG1hY2hpbmUKaW1wb3J0IG1peGdvX2FpCmZyb20gbWl4Z29fbWluaSBpbXBvcnQgb25ib2FyZF9tYXRyaXgKaW1wb3J0IHRpbWUKCgp1YXJ0MT1tYWNoaW5lLlVBUlQoMSwgdHg9Miwgcng9MSwgYmF1ZHJhdGU9MTE1MjAwKQphaV9zZW5zb3I9bWl4Z29fYWkuQUkodWFydDEsIHF1aWNrPTEpCmFpX3NlbnNvci5jb25maWd1cmUoOCwgOSwgcmVzdGFydD1UcnVlKQp3aGlsZSBUcnVlOgogICAgaW5mbyA9IGFpX3NlbnNvci5mYWNlX2RldGVjdCgpCiAgICBmb3IgZmFjZSBpbiBpbmZvOgogICAgICAgIHBlb3BsZSA9IGZhY2UuaW5mbzEKICAgICAgICBvbmJvYXJkX21hdHJpeC5zY3JvbGwocGVvcGxlKQogICAgdGltZS5zbGVlcCgwLjEpCg==</code>sZWVwKDAuMSkK</code>

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long