Skip to content

Commit 83803a7

Browse files
authored
fix ollama bug (#999)
### What problem does this PR solve? ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
1 parent c3c2515 commit 83803a7

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

api/db/services/dialog_service.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ def count():
5858
if c < max_length:
5959
return c, msg
6060

61-
ll = num_tokens_from_string(msg_[0].content)
62-
l = num_tokens_from_string(msg_[-1].content)
61+
ll = num_tokens_from_string(msg_[0]["content"])
62+
l = num_tokens_from_string(msg_[-1]["content"])
6363
if ll / (ll + l) > 0.8:
64-
m = msg_[0].content
64+
m = msg_[0]["content"]
6565
m = encoder.decode(encoder.encode(m)[:max_length - l])
66-
msg[0].content = m
66+
msg[0]["content"] = m
6767
return max_length, msg
6868

69-
m = msg_[1].content
69+
m = msg_[1]["content"]
7070
m = encoder.decode(encoder.encode(m)[:max_length - l])
71-
msg[1].content = m
71+
msg[1]["content"] = m
7272
return max_length, msg
7373

7474

0 commit comments

Comments
 (0)