dialoghelper 0.0.15__py3-none-any.whl → 0.0.17__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.

Potentially problematic release.


This version of dialoghelper might be problematic. Click here for more details.

dialoghelper/__init__.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "0.0.15"
1
+ __version__ = "0.0.17"
2
2
  from .core import *
dialoghelper/_modidx.py CHANGED
@@ -8,6 +8,7 @@ d = { 'settings': { 'branch': 'main',
8
8
  'syms': { 'dialoghelper.core': { 'dialoghelper.core._add_msg_unsafe': ('core.html#_add_msg_unsafe', 'dialoghelper/core.py'),
9
9
  'dialoghelper.core._msg': ('core.html#_msg', 'dialoghelper/core.py'),
10
10
  'dialoghelper.core._umsg': ('core.html#_umsg', 'dialoghelper/core.py'),
11
+ 'dialoghelper.core.add_html': ('core.html#add_html', 'dialoghelper/core.py'),
11
12
  'dialoghelper.core.add_msg': ('core.html#add_msg', 'dialoghelper/core.py'),
12
13
  'dialoghelper.core.del_msg': ('core.html#del_msg', 'dialoghelper/core.py'),
13
14
  'dialoghelper.core.export_dialog': ('core.html#export_dialog', 'dialoghelper/core.py'),
dialoghelper/core.py CHANGED
@@ -2,8 +2,8 @@
2
2
 
3
3
  # %% auto 0
4
4
  __all__ = ['Placements', 'empty', 'get_db', 'find_var', 'find_dialog_id', 'find_msgs', 'find_msg_id', 'read_msg_ids', 'msg_idx',
5
- 'read_msg', 'del_msg', 'add_msg', 'update_msg', 'load_gist', 'gist_file', 'import_string', 'is_usable_tool',
6
- 'mk_toollist', 'import_gist', 'export_dialog', 'import_dialog', 'tool_info', 'asdict']
5
+ 'read_msg', 'add_html', 'del_msg', 'add_msg', 'update_msg', 'load_gist', 'gist_file', 'import_string',
6
+ 'is_usable_tool', 'mk_toollist', 'import_gist', 'export_dialog', 'import_dialog', 'tool_info', 'asdict']
7
7
 
8
8
  # %% ../nbs/00_core.ipynb
9
9
  import json, importlib, linecache
@@ -11,6 +11,7 @@ from typing import Dict
11
11
  from tempfile import TemporaryDirectory
12
12
  from ipykernel_helper import *
13
13
  from dataclasses import dataclass
14
+ from fastcore.xml import to_xml
14
15
 
15
16
  from fastcore.utils import *
16
17
  from fastcore.meta import delegates
@@ -98,6 +99,13 @@ def read_msg(n:int=-1, # Message index (if relative, +ve is downwards)
98
99
  db = get_db()
99
100
  return db.t.message.selectone('sid=?', [ids[idx]])
100
101
 
102
+ # %% ../nbs/00_core.ipynb
103
+ def add_html(
104
+ content:str, # The HTML to send to the client (generally should include hx-swap-oob)
105
+ ):
106
+ "Send HTML to the browser to be swapped into the DOM"
107
+ xpost('http://localhost:5001/add_html_', data=dict(content=to_xml(content)))
108
+
101
109
  # %% ../nbs/00_core.ipynb
102
110
  def del_msg(
103
111
  sid:str=None, # sid (stable id -- pk) of message that placement is relative to (if None, uses current message)
@@ -140,7 +148,8 @@ def add_msg(
140
148
  try: json.loads(ot or '[]')
141
149
  except: return "Code output must be valid json"
142
150
  if not sid: sid = find_msg_id()
143
- data = dict(content=content, placement=placement, sid=sid, **kwargs)
151
+ data = dict(placement=placement, sid=sid, **kwargs)
152
+ if content is not None: data['content'] = content
144
153
  return xpost('http://localhost:5001/add_relative_', data=data).text
145
154
 
146
155
  # %% ../nbs/00_core.ipynb
@@ -171,7 +180,7 @@ def _umsg(
171
180
  @delegates(_umsg)
172
181
  def update_msg(
173
182
  sid:str=None, # sid (stable id -- pk) of message to update (if None, uses current message)
174
- content:str|None = None, # Content of the message (i.e the message prompt, code, or note text)
183
+ content:str|None=None, # Content of the message (i.e the message prompt, code, or note text)
175
184
  msg:Optional[Dict]=None, # Dictionary of field keys/values to update
176
185
  **kwargs):
177
186
  """Update an existing message. Provide either `msg` OR field key/values to update.
@@ -280,6 +289,7 @@ def import_dialog(fname, add_header=True):
280
289
  def tool_info():
281
290
  cts='''Tools available from `dialoghelper`:
282
291
 
292
+ - &`add_html`: Send HTML to the browser to be swapped into the DOM using hx-swap-oob.
283
293
  - &`find_dialog_id`: Get the current dialog id.
284
294
  - &`find_msg_id`: Get the current message id.
285
295
  - &`find_msgs`: Find messages in current specific dialog that contain the given information.
dialoghelper/db_dc.py CHANGED
@@ -77,6 +77,7 @@ class Message:
77
77
  o_collapsed: int | None = '0'
78
78
  header_collapsed: int | None = '0'
79
79
  pinned: int | None = '0'
80
+ use_thinking: int | None = 0
80
81
 
81
82
  @dataclass
82
83
  class Secret:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dialoghelper
3
- Version: 0.0.15
3
+ Version: 0.0.17
4
4
  Summary: Helper functions for solveit dialogs
5
5
  Home-page: https://github.com/AnswerDotAI/dialoghelper
6
6
  Author: Jeremy Howard
@@ -18,7 +18,7 @@ Classifier: License :: OSI Approved :: Apache Software License
18
18
  Requires-Python: >=3.9
19
19
  Description-Content-Type: text/markdown
20
20
  License-File: LICENSE
21
- Requires-Dist: fastcore
21
+ Requires-Dist: fastcore>=1.8.5
22
22
  Requires-Dist: fastlite
23
23
  Requires-Dist: ghapi
24
24
  Requires-Dist: ipykernel-helper
@@ -0,0 +1,10 @@
1
+ dialoghelper/__init__.py,sha256=iwcIRnY-hzTvlvcCnwyLfa-0GCtmC0fPSKlBQgXUyBo,43
2
+ dialoghelper/_modidx.py,sha256=il4I8H0rrleInprpaXaQ3Lyy4_C1ipPVQvaZ8WopN7I,3126
3
+ dialoghelper/core.py,sha256=2GdSvvEFWMAEJ_FNRUj9LoiB1x8zQZcYbMOJfFyvClM,12999
4
+ dialoghelper/db_dc.py,sha256=mi2Q2am_SoAPGpNQg7KPFS5pR9WEapRXT8ypkNmMfw0,2330
5
+ dialoghelper-0.0.17.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
6
+ dialoghelper-0.0.17.dist-info/METADATA,sha256=XET3SvzannEw7Hq_CP8Qs1rEzGwT2l16Xvwo2YGHFZo,2565
7
+ dialoghelper-0.0.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
+ dialoghelper-0.0.17.dist-info/entry_points.txt,sha256=wvDeX-XTS_XVjWiiPQe6yVfmyNwy9eCr36ewp9baFIg,46
9
+ dialoghelper-0.0.17.dist-info/top_level.txt,sha256=VXLlkgltFs_q-XB9imt2G64I_-MPm1RnxlpvUWPuLKM,13
10
+ dialoghelper-0.0.17.dist-info/RECORD,,
@@ -1,10 +0,0 @@
1
- dialoghelper/__init__.py,sha256=dXuF6Y3XUXblN4PkEpkmXrD8vDPhYo7XLaXILawxjwQ,43
2
- dialoghelper/_modidx.py,sha256=BmhVoIv53snN6JQm_EzJp-bu793QuY7EZg2hKaq5_7E,3013
3
- dialoghelper/core.py,sha256=8DlmNRQT4PeMWychhQETXAJKgJ72Z8CjEW09Zh_VgJk,12562
4
- dialoghelper/db_dc.py,sha256=ieSie_K1HHXACEJVZ0rMkD_uo42GgmMqqKDYrodjhtM,2297
5
- dialoghelper-0.0.15.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
6
- dialoghelper-0.0.15.dist-info/METADATA,sha256=G4p7L6QivWW736VWNazRXXmNW3nvVSast69RUKesQrM,2558
7
- dialoghelper-0.0.15.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
8
- dialoghelper-0.0.15.dist-info/entry_points.txt,sha256=wvDeX-XTS_XVjWiiPQe6yVfmyNwy9eCr36ewp9baFIg,46
9
- dialoghelper-0.0.15.dist-info/top_level.txt,sha256=VXLlkgltFs_q-XB9imt2G64I_-MPm1RnxlpvUWPuLKM,13
10
- dialoghelper-0.0.15.dist-info/RECORD,,