Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ox696c
ktransformers
Commits
4fb19bfc
Commit
4fb19bfc
authored
Apr 17, 2025
by
Creeper-MZ
Browse files
Update chat.py
parent
cb266c98
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
ktransformers/server/api/openai/endpoints/chat.py
ktransformers/server/api/openai/endpoints/chat.py
+7
-5
No files found.
ktransformers/server/api/openai/endpoints/chat.py
View file @
4fb19bfc
...
...
@@ -399,6 +399,12 @@ async def chat_completion(request: Request, create: ChatCompletionCreate):
buffer
=
""
# Build Response
message
=
{
"role"
:
"assistant"
,
"content"
:
None
if
tool_calls
else
full_content
}
if
tool_calls
:
message
[
"tool_calls"
]
=
tool_calls
response
=
{
"id"
:
id
,
"object"
:
"chat.completion"
,
...
...
@@ -406,11 +412,7 @@ async def chat_completion(request: Request, create: ChatCompletionCreate):
"model"
:
Config
().
model_name
,
"choices"
:
[{
"index"
:
0
,
"message"
:
{
"role"
:
"assistant"
,
"content"
:
None
if
tool_calls
else
full_content
,
"tool_calls"
:
tool_calls
if
tool_calls
else
None
},
"message"
:
message
,
"finish_reason"
:
finish_reason
or
"stop"
}],
"usage"
:
usage
.
__dict__
if
'usage'
in
locals
()
else
None
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment