mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
commit
ab94468ffa
@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
|
|||||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.5.9] - 2025-02-05
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- **💡 "Think" Tag Display Issue**: Resolved a bug where the "Think" tag was not functioning correctly, ensuring proper visualization of the model's reasoning process before delivering responses.
|
||||||
|
|
||||||
## [0.5.8] - 2025-02-05
|
## [0.5.8] - 2025-02-05
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
@ -1231,8 +1231,10 @@ async def process_chat_response(
|
|||||||
content_blocks[-1]["content"] = content_blocks[-1][
|
content_blocks[-1]["content"] = content_blocks[-1][
|
||||||
"content"
|
"content"
|
||||||
].replace(match.group(0), "")
|
].replace(match.group(0), "")
|
||||||
|
|
||||||
if not content_blocks[-1]["content"]:
|
if not content_blocks[-1]["content"]:
|
||||||
content_blocks.pop()
|
content_blocks.pop()
|
||||||
|
|
||||||
# Append the new block
|
# Append the new block
|
||||||
content_blocks.append(
|
content_blocks.append(
|
||||||
{
|
{
|
||||||
@ -1248,18 +1250,34 @@ async def process_chat_response(
|
|||||||
tag = content_blocks[-1]["tag"]
|
tag = content_blocks[-1]["tag"]
|
||||||
# Match end tag e.g., </tag>
|
# Match end tag e.g., </tag>
|
||||||
end_tag_pattern = rf"</{tag}>"
|
end_tag_pattern = rf"</{tag}>"
|
||||||
|
|
||||||
if re.search(end_tag_pattern, content):
|
if re.search(end_tag_pattern, content):
|
||||||
|
end_flag = True
|
||||||
|
|
||||||
block_content = content_blocks[-1]["content"]
|
block_content = content_blocks[-1]["content"]
|
||||||
# Strip start and end tags from the content
|
# Strip start and end tags from the content
|
||||||
start_tag_pattern = rf"<{tag}(.*?)>"
|
start_tag_pattern = rf"<{tag}(.*?)>"
|
||||||
block_content = re.sub(
|
block_content = re.sub(
|
||||||
start_tag_pattern, "", block_content
|
start_tag_pattern, "", block_content
|
||||||
).strip()
|
).strip()
|
||||||
block_content = re.sub(
|
|
||||||
end_tag_pattern, "", block_content
|
end_tag_regex = re.compile(end_tag_pattern, re.DOTALL)
|
||||||
).strip()
|
split_content = end_tag_regex.split(block_content, maxsplit=1)
|
||||||
|
|
||||||
|
# Content inside the tag
|
||||||
|
block_content = (
|
||||||
|
split_content[0].strip() if split_content else ""
|
||||||
|
)
|
||||||
|
|
||||||
|
# Leftover content (everything after `</tag>`)
|
||||||
|
leftover_content = (
|
||||||
|
split_content[1].strip() if len(split_content) > 1 else ""
|
||||||
|
)
|
||||||
|
|
||||||
|
print(f"block_content: {block_content}")
|
||||||
|
print(f"leftover_content: {leftover_content}")
|
||||||
|
|
||||||
if block_content:
|
if block_content:
|
||||||
end_flag = True
|
|
||||||
content_blocks[-1]["content"] = block_content
|
content_blocks[-1]["content"] = block_content
|
||||||
content_blocks[-1]["ended_at"] = time.time()
|
content_blocks[-1]["ended_at"] = time.time()
|
||||||
content_blocks[-1]["duration"] = int(
|
content_blocks[-1]["duration"] = int(
|
||||||
@ -1270,19 +1288,29 @@ async def process_chat_response(
|
|||||||
content_blocks.append(
|
content_blocks.append(
|
||||||
{
|
{
|
||||||
"type": "text",
|
"type": "text",
|
||||||
"content": "",
|
"content": leftover_content,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
# Clean processed content
|
|
||||||
content = re.sub(
|
|
||||||
rf"<{tag}(.*?)>(.|\n)*?</{tag}>",
|
|
||||||
"",
|
|
||||||
content,
|
|
||||||
flags=re.DOTALL,
|
|
||||||
)
|
|
||||||
else:
|
else:
|
||||||
# Remove the block if content is empty
|
# Remove the block if content is empty
|
||||||
content_blocks.pop()
|
content_blocks.pop()
|
||||||
|
|
||||||
|
if leftover_content:
|
||||||
|
content_blocks.append(
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"content": leftover_content,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
# Clean processed content
|
||||||
|
content = re.sub(
|
||||||
|
rf"<{tag}(.*?)>(.|\n)*?</{tag}>",
|
||||||
|
"",
|
||||||
|
content,
|
||||||
|
flags=re.DOTALL,
|
||||||
|
)
|
||||||
|
|
||||||
return content, content_blocks, end_flag
|
return content, content_blocks, end_flag
|
||||||
|
|
||||||
message = Chats.get_message_by_id_and_message_id(
|
message = Chats.get_message_by_id_and_message_id(
|
||||||
@ -1402,6 +1430,15 @@ async def process_chat_response(
|
|||||||
|
|
||||||
if value:
|
if value:
|
||||||
content = f"{content}{value}"
|
content = f"{content}{value}"
|
||||||
|
|
||||||
|
if not content_blocks:
|
||||||
|
content_blocks.append(
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"content": "",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
content_blocks[-1]["content"] = (
|
content_blocks[-1]["content"] = (
|
||||||
content_blocks[-1]["content"] + value
|
content_blocks[-1]["content"] + value
|
||||||
)
|
)
|
||||||
@ -1461,14 +1498,23 @@ async def process_chat_response(
|
|||||||
log.debug("Error: ", e)
|
log.debug("Error: ", e)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
# Clean up the last text block
|
if content_blocks:
|
||||||
if content_blocks[-1]["type"] == "text":
|
# Clean up the last text block
|
||||||
content_blocks[-1]["content"] = content_blocks[-1][
|
if content_blocks[-1]["type"] == "text":
|
||||||
"content"
|
content_blocks[-1]["content"] = content_blocks[-1][
|
||||||
].strip()
|
"content"
|
||||||
|
].strip()
|
||||||
|
|
||||||
if not content_blocks[-1]["content"]:
|
if not content_blocks[-1]["content"]:
|
||||||
content_blocks.pop()
|
content_blocks.pop()
|
||||||
|
|
||||||
|
if not content_blocks:
|
||||||
|
content_blocks.append(
|
||||||
|
{
|
||||||
|
"type": "text",
|
||||||
|
"content": "",
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
if response_tool_calls:
|
if response_tool_calls:
|
||||||
tool_calls.append(response_tool_calls)
|
tool_calls.append(response_tool_calls)
|
||||||
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "open-webui",
|
"name": "open-webui",
|
||||||
"version": "0.5.8",
|
"version": "0.5.9",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "open-webui",
|
"name": "open-webui",
|
||||||
"version": "0.5.8",
|
"version": "0.5.9",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@codemirror/lang-javascript": "^6.2.2",
|
"@codemirror/lang-javascript": "^6.2.2",
|
||||||
"@codemirror/lang-python": "^6.1.6",
|
"@codemirror/lang-python": "^6.1.6",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "open-webui",
|
"name": "open-webui",
|
||||||
"version": "0.5.8",
|
"version": "0.5.9",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "npm run pyodide:fetch && vite dev --host",
|
"dev": "npm run pyodide:fetch && vite dev --host",
|
||||||
|
Loading…
Reference in New Issue
Block a user