Skip to content

Commit da2a5e6

Browse files
authored
Merge pull request #160 from danielferr85/main
Fix streaming response in rkllama_client (mention in issue #154)
2 parents 446c161 + faef706 commit da2a5e6

4 files changed

Lines changed: 9 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# RKLLama: LLM Server and Client for Rockchip 3588/3576
22

3-
### [Version: 0.0.71](#New-Version)
3+
### [Version: 0.0.72](#New-Version)
44

55
Video demo ( version 0.0.1 ):
66

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "rkllama"
3-
version = "0.0.71"
3+
version = "0.0.72"
44
authors = [
55
{ name="NotPunchnox", email="punchnoxpro@gmail.com" },
66
{ name="TomJacobsUK", email="tom@tomjacobs.co.uk" },

src/rkllama/client/client.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,10 +241,12 @@ def send_message(model, message):
241241
final_json = response_json
242242

243243
if len(response_json["choices"]) > 0 and "delta" in response_json["choices"][0].keys():
244-
content_chunk = response_json["choices"][0]["delta"]["content"]
245-
sys.stdout.write(content_chunk)
246-
sys.stdout.flush()
247-
assistant_message += content_chunk
244+
if "content" in response_json["choices"][0]["delta"].keys():
245+
content_chunk = response_json["choices"][0]["delta"]["content"]
246+
if content_chunk:
247+
sys.stdout.write(content_chunk)
248+
sys.stdout.flush()
249+
assistant_message += content_chunk
248250
fr = response_json["choices"][0].get("finish_reason")
249251
if fr:
250252
finish_reason = fr

src/rkllama/server/server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ def embeddings_ollama():
13371337
def ollama_version():
13381338
"""Return a dummy version to be compatible with Ollama clients"""
13391339
return jsonify({
1340-
"version": "0.0.71"
1340+
"version": "0.0.72"
13411341
}), 200
13421342

13431343

0 commit comments

Comments
 (0)