From a94726ea08a7f5cb3e495b8b290e61bf49e6f54f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E7=AB=8B=E5=B8=AE?= <3294713004@qq.com> Date: Sun, 25 May 2025 15:59:37 +0800 Subject: [PATCH] =?UTF-8?q?feat(borads):=20=E4=BC=98=E5=8C=96mp=E4=B8=8B?= =?UTF-8?q?=E8=BF=9E=E6=8E=A5Ollama=E5=B9=B3=E5=8F=B0=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E5=9C=B0=E5=9D=80=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- boards/default_src/micropython/origin/build/lib/ollama.py | 4 +++- boards/default_src/micropython_educore/template.xml | 2 +- boards/default_src/micropython_esp32/template.xml | 2 +- boards/default_src/micropython_esp32c2/template.xml | 2 +- boards/default_src/micropython_esp32c3/template.xml | 2 +- boards/default_src/micropython_esp32s2/template.xml | 2 +- boards/default_src/micropython_esp32s3/template.xml | 2 +- boards/default_src/micropython_robot/template.xml | 2 +- 8 files changed, 10 insertions(+), 8 deletions(-) diff --git a/boards/default_src/micropython/origin/build/lib/ollama.py b/boards/default_src/micropython/origin/build/lib/ollama.py index e13c1bfa..5ecd4a78 100644 --- a/boards/default_src/micropython/origin/build/lib/ollama.py +++ b/boards/default_src/micropython/origin/build/lib/ollama.py @@ -12,6 +12,7 @@ class Ollama(): "Content-Type": "application/json" } self._url = url + self._chat_url = "{}/api/chat".format(self._url) self._max_retries = 1 self._max_history_num = max_history_num self._timeout = 10000 @@ -30,6 +31,7 @@ class Ollama(): def set_custom_url(self, url): self._url = url + self._chat_url = "{}/api/chat".format(self._url) def select_model(self, model_name): self._data["model"] = model_name @@ -57,7 +59,7 @@ class Ollama(): data = json.dumps(self._data).encode('utf-8') for i in range(0, self._max_retries): response = urequests.post( - self._url, headers=self._heads, data=data) + self._chat_url, headers=self._heads, data=data) if response.status_code == 200: break time.sleep(1) diff --git a/boards/default_src/micropython_educore/template.xml b/boards/default_src/micropython_educore/template.xml index 7d1fe7e7..d0abeb61 100644 --- a/boards/default_src/micropython_educore/template.xml +++ b/boards/default_src/micropython_educore/template.xml @@ -7244,7 +7244,7 @@ - 192.168.1.1 + http://192.168.1.1 diff --git a/boards/default_src/micropython_esp32/template.xml b/boards/default_src/micropython_esp32/template.xml index 39bd4adf..885a8ed0 100644 --- a/boards/default_src/micropython_esp32/template.xml +++ b/boards/default_src/micropython_esp32/template.xml @@ -7111,7 +7111,7 @@ - 192.168.1.1 + http://192.168.1.1 diff --git a/boards/default_src/micropython_esp32c2/template.xml b/boards/default_src/micropython_esp32c2/template.xml index bf1aa031..937f1d51 100644 --- a/boards/default_src/micropython_esp32c2/template.xml +++ b/boards/default_src/micropython_esp32c2/template.xml @@ -7003,7 +7003,7 @@ - 192.168.1.1 + http://192.168.1.1 diff --git a/boards/default_src/micropython_esp32c3/template.xml b/boards/default_src/micropython_esp32c3/template.xml index 17d386d4..378c970e 100644 --- a/boards/default_src/micropython_esp32c3/template.xml +++ b/boards/default_src/micropython_esp32c3/template.xml @@ -6917,7 +6917,7 @@ - 192.168.1.1 + http://192.168.1.1 diff --git a/boards/default_src/micropython_esp32s2/template.xml b/boards/default_src/micropython_esp32s2/template.xml index 45e6578a..4ab067a7 100644 --- a/boards/default_src/micropython_esp32s2/template.xml +++ b/boards/default_src/micropython_esp32s2/template.xml @@ -6647,7 +6647,7 @@ - 192.168.1.1 + http://192.168.1.1 diff --git a/boards/default_src/micropython_esp32s3/template.xml b/boards/default_src/micropython_esp32s3/template.xml index c5d025d6..092aa5fd 100644 --- a/boards/default_src/micropython_esp32s3/template.xml +++ b/boards/default_src/micropython_esp32s3/template.xml @@ -7389,7 +7389,7 @@ - 192.168.1.1 + http://192.168.1.1 diff --git a/boards/default_src/micropython_robot/template.xml b/boards/default_src/micropython_robot/template.xml index 2b49c794..b5046f13 100644 --- a/boards/default_src/micropython_robot/template.xml +++ b/boards/default_src/micropython_robot/template.xml @@ -5678,7 +5678,7 @@ - 192.168.1.1 + http://192.168.1.1