Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Changelog

## [0.3.1a1](https://github.com/OpenVoiceOS/ovos-persona-server/tree/0.3.1a1) (2025-03-05)
## [0.3.2a1](https://github.com/OpenVoiceOS/ovos-persona-server/tree/0.3.2a1) (2025-03-05)

[Full Changelog](https://github.com/OpenVoiceOS/ovos-persona-server/compare/0.3.0...0.3.1a1)
[Full Changelog](https://github.com/OpenVoiceOS/ovos-persona-server/compare/0.3.1...0.3.2a1)

**Merged pull requests:**

- fix: persona name , add models [\#4](https://github.com/OpenVoiceOS/ovos-persona-server/pull/4) ([JarbasAl](https://github.com/JarbasAl))
- Fix/streaming [\#6](https://github.com/OpenVoiceOS/ovos-persona-server/pull/6) ([JarbasAl](https://github.com/JarbasAl))



Expand Down
34 changes: 2 additions & 32 deletions ovos_persona_server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,42 +25,12 @@ def status():
"models": {s: persona.config.get(s, {}).get("model")
for s in persona.solvers.loaded_modules.keys()}}

@app.route("/completions", methods=["POST"])
def completions():
prompt = request.get_json().get("prompt")

completion_id = "".join(random.choices(string.ascii_letters + string.digits, k=28))
completion_timestamp = int(time.time())

response = persona.complete(prompt)

return {"choices": [
{
"finish_reason": "length",
"index": 0,
"text": response
}
],
"id": f"chatcmpl-{completion_id}",
"created": completion_timestamp,
"model": persona.name,
"object": "text_completion",
"usage": {
"prompt_tokens": None,
"completion_tokens": None,
"total_tokens": None,
},

}

@app.route("/chat/completions", methods=["POST"])
def chat_completions():
data = request.get_json()
stream = data.get("stream", False)
messages = data.get("messages")

response = persona.chat(messages)

completion_id = "".join(random.choices(string.ascii_letters + string.digits, k=28))
completion_timestamp = int(time.time())

Expand All @@ -75,7 +45,7 @@ def chat_completions():
"index": 0,
"message": {
"role": "assistant",
"content": response,
"content": persona.chat(messages),
},
"finish_reason": "stop",
}
Expand All @@ -88,7 +58,7 @@ def chat_completions():
}

def streaming():
for chunk in response:
for chunk in persona.stream(messages):
completion_data = {
"id": f"chatcmpl-{completion_id}",
"object": "chat.completion.chunk",
Expand Down
4 changes: 2 additions & 2 deletions ovos_persona_server/version.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# START_VERSION_BLOCK
VERSION_MAJOR = 0
VERSION_MINOR = 3
VERSION_BUILD = 1
VERSION_ALPHA = 0
VERSION_BUILD = 2
VERSION_ALPHA = 1
# END_VERSION_BLOCK