shinychat 0.2.2__py3-none-any.whl → 0.2.3__py3-none-any.whl

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/__version.py CHANGED
@@ -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.2'
32
- __version_tuple__ = version_tuple = (0, 2, 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, TagList
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
@@ -163,10 +163,15 @@ try:
163
163
 
164
164
  @message_content.register
165
165
  def _(message: Turn):
166
- contents = TagList()
166
+ from chatlas import ContentToolResult
167
+ content = ""
167
168
  for x in message.contents:
168
- contents.append(message_content(x).content)
169
- return ChatMessage(content=contents)
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)
170
175
 
171
176
  @message_content_chunk.register
172
177
  def _(chunk: Turn):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: shinychat
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: An AI Chat interface for Shiny apps.
5
5
  Project-URL: Homepage, https://posit-dev.github.io/shinychat/
6
6
  Project-URL: Documentation, https://posit-dev.github.io/shinychat/py/
@@ -1,8 +1,8 @@
1
1
  shinychat/__init__.py,sha256=wT_dA5RTwONRhUx2MpVKu9o-eLkSqUDX8sU9W2GQYLY,316
2
- shinychat/__version.py,sha256=o3ZTescp-19Z9cvBGq9dQnbppljgzdUYUf98Nov0spY,704
2
+ shinychat/__version.py,sha256=kBRz0P2plw1eVdIpt70W6m1LMbEIhLY3RyOfVGdubaI,704
3
3
  shinychat/_chat.py,sha256=xI32fiiDPx8UCGES1klfneqmxiEWdSWY2F0V0g42pd4,65831
4
4
  shinychat/_chat_bookmark.py,sha256=E8okr1dkN4VNDtORyPVZnCXihmfV9jFGD6UQq4Z2p5s,3027
5
- shinychat/_chat_normalize.py,sha256=zItuC1OXK-f_mqwfMPW2cWqlWyI8eKiHjBk_cUSA34s,9984
5
+ shinychat/_chat_normalize.py,sha256=7mzVcb2MPGJpjbMIyrrbxTD0NZ727oB3l4f4k8h84Ls,10170
6
6
  shinychat/_chat_normalize_chatlas.py,sha256=6iMObxHHSPZ0odWiWNTRUX52Vt8q0ocRaWvsdRjw9zk,12925
7
7
  shinychat/_chat_provider_types.py,sha256=gsBPAs0uro1YcepS1xEiCXyh4JMhpE7kjs28_LSspk0,4328
8
8
  shinychat/_chat_tokenizer.py,sha256=m-YS8j5TC5oJ2uTsIus04_NRYeldFbpHzsoanL2EA-E,1868
@@ -25,7 +25,7 @@ shinychat/www/markdown-stream/markdown-stream.css,sha256=m-yRlzTkX36piqx1T8Nvx18
25
25
  shinychat/www/markdown-stream/markdown-stream.css.map,sha256=afnnfIkD6AuwmHWnzYKDR2qpn8GBzBdqsQ8QY2wH5Xc,9191
26
26
  shinychat/www/markdown-stream/markdown-stream.js,sha256=mcbHHYdKP1tSBAhV830UPOo36q4NBcs6VOvN_i3xC7g,272842
27
27
  shinychat/www/markdown-stream/markdown-stream.js.map,sha256=P7IdHoJhgJ_M9VlIHhzmzwDurBvIIS3FAkfsV86cMz0,1119239
28
- shinychat-0.2.2.dist-info/METADATA,sha256=YX1F15v16SQxoQBcHEOn24UJ0pbQSM_1bE58_4rStJM,3203
29
- shinychat-0.2.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
- shinychat-0.2.2.dist-info/licenses/LICENSE,sha256=oB2X1GZjjWFbXGMjbtPLWg29aj7BzjbecsnG7yEaY8U,1078
31
- shinychat-0.2.2.dist-info/RECORD,,
28
+ shinychat-0.2.3.dist-info/METADATA,sha256=jcXqAMK2RRICRki93mmk1rQob7ENthjqQVgOpZblWss,3203
29
+ shinychat-0.2.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
30
+ shinychat-0.2.3.dist-info/licenses/LICENSE,sha256=oB2X1GZjjWFbXGMjbtPLWg29aj7BzjbecsnG7yEaY8U,1078
31
+ shinychat-0.2.3.dist-info/RECORD,,