shinychat 0.2.1__tar.gz → 0.2.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {shinychat-0.2.1 → shinychat-0.2.3}/PKG-INFO +1 -1
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/__version.py +2 -2
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/_chat_normalize.py +13 -4
- {shinychat-0.2.1 → shinychat-0.2.3}/.gitignore +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/LICENSE +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/README.md +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/__init__.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/_chat.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/_chat_bookmark.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/_chat_normalize_chatlas.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/_chat_provider_types.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/_chat_tokenizer.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/_chat_types.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/_html_deps_py_shiny.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/_markdown_stream.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/_typing_extensions.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/_utils.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/express/__init__.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/playwright/__init__.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/playwright/_chat.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/py.typed +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/types/__init__.py +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/www/GIT_VERSION +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/www/chat/chat.css +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/www/chat/chat.css.map +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/www/chat/chat.js +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/www/chat/chat.js.map +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/www/markdown-stream/markdown-stream.css +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/www/markdown-stream/markdown-stream.css.map +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/www/markdown-stream/markdown-stream.js +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/www/markdown-stream/markdown-stream.js.map +0 -0
- {shinychat-0.2.1 → shinychat-0.2.3}/pyproject.toml +0 -0
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
|
|
28
28
|
commit_id: COMMIT_ID
|
29
29
|
__commit_id__: COMMIT_ID
|
30
30
|
|
31
|
-
__version__ = version = '0.2.
|
32
|
-
__version_tuple__ = version_tuple = (0, 2,
|
31
|
+
__version__ = version = '0.2.3'
|
32
|
+
__version_tuple__ = version_tuple = (0, 2, 3)
|
33
33
|
|
34
34
|
__commit_id__ = commit_id = None
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
3
3
|
import sys
|
4
4
|
from functools import singledispatch
|
5
5
|
|
6
|
-
from htmltools import HTML, Tagifiable
|
6
|
+
from htmltools import HTML, Tagifiable
|
7
7
|
|
8
8
|
from ._chat_normalize_chatlas import tool_request_contents, tool_result_contents
|
9
9
|
from ._chat_types import ChatMessage
|
@@ -44,6 +44,8 @@ def message_content(message):
|
|
44
44
|
"""
|
45
45
|
if isinstance(message, (str, HTML)) or message is None:
|
46
46
|
return ChatMessage(content=message)
|
47
|
+
if isinstance(message, ChatMessage):
|
48
|
+
return message
|
47
49
|
if isinstance(message, dict):
|
48
50
|
if "content" not in message:
|
49
51
|
raise ValueError("Message dictionary must have a 'content' key")
|
@@ -90,6 +92,8 @@ def message_content_chunk(chunk):
|
|
90
92
|
"""
|
91
93
|
if isinstance(chunk, (str, HTML)) or chunk is None:
|
92
94
|
return ChatMessage(content=chunk)
|
95
|
+
if isinstance(chunk, ChatMessage):
|
96
|
+
return chunk
|
93
97
|
if isinstance(chunk, dict):
|
94
98
|
if "content" not in chunk:
|
95
99
|
raise ValueError("Chunk dictionary must have a 'content' key")
|
@@ -159,10 +163,15 @@ try:
|
|
159
163
|
|
160
164
|
@message_content.register
|
161
165
|
def _(message: Turn):
|
162
|
-
|
166
|
+
from chatlas import ContentToolResult
|
167
|
+
content = ""
|
163
168
|
for x in message.contents:
|
164
|
-
|
165
|
-
|
169
|
+
content += message_content(x).content
|
170
|
+
if all(isinstance(x, ContentToolResult) for x in message.contents):
|
171
|
+
role = "assistant"
|
172
|
+
else:
|
173
|
+
role = message.role
|
174
|
+
return ChatMessage(content=content, role=role)
|
166
175
|
|
167
176
|
@message_content_chunk.register
|
168
177
|
def _(chunk: Turn):
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/www/markdown-stream/markdown-stream.css
RENAMED
File without changes
|
{shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/www/markdown-stream/markdown-stream.css.map
RENAMED
File without changes
|
{shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/www/markdown-stream/markdown-stream.js
RENAMED
File without changes
|
{shinychat-0.2.1 → shinychat-0.2.3}/pkg-py/src/shinychat/www/markdown-stream/markdown-stream.js.map
RENAMED
File without changes
|
File without changes
|