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
chenpangpang
open-webui
Commits
05977bd1
Unverified
Commit
05977bd1
authored
Aug 04, 2024
by
Timothy Jaeryang Baek
Committed by
GitHub
Aug 04, 2024
Browse files
Merge pull request #4342 from michaelpoluektov/fix-non-streaming-function-text
fix: function returning "str"
parents
8074289a
f8ba0334
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
backend/utils/misc.py
backend/utils/misc.py
+3
-2
No files found.
backend/utils/misc.py
View file @
05977bd1
...
@@ -97,18 +97,19 @@ def openai_chat_message_template(model: str):
...
@@ -97,18 +97,19 @@ def openai_chat_message_template(model: str):
}
}
def
openai_chat_chunk_message_template
(
model
:
str
,
message
:
str
):
def
openai_chat_chunk_message_template
(
model
:
str
,
message
:
str
)
->
dict
:
template
=
openai_chat_message_template
(
model
)
template
=
openai_chat_message_template
(
model
)
template
[
"object"
]
=
"chat.completion.chunk"
template
[
"object"
]
=
"chat.completion.chunk"
template
[
"choices"
][
0
][
"delta"
]
=
{
"content"
:
message
}
template
[
"choices"
][
0
][
"delta"
]
=
{
"content"
:
message
}
return
template
return
template
def
openai_chat_completion_message_template
(
model
:
str
,
message
:
str
):
def
openai_chat_completion_message_template
(
model
:
str
,
message
:
str
)
->
dict
:
template
=
openai_chat_message_template
(
model
)
template
=
openai_chat_message_template
(
model
)
template
[
"object"
]
=
"chat.completion"
template
[
"object"
]
=
"chat.completion"
template
[
"choices"
][
0
][
"message"
]
=
{
"content"
:
message
,
"role"
:
"assistant"
}
template
[
"choices"
][
0
][
"message"
]
=
{
"content"
:
message
,
"role"
:
"assistant"
}
template
[
"choices"
][
0
][
"finish_reason"
]
=
"stop"
template
[
"choices"
][
0
][
"finish_reason"
]
=
"stop"
return
template
def
get_gravatar_url
(
email
):
def
get_gravatar_url
(
email
):
...
...
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