Skip to content

Commit 7caea8b

Browse files
committed
fixes #20
1 parent 2e33de9 commit 7caea8b

3 files changed

Lines changed: 9 additions & 8 deletions

File tree

dialoghelper/core.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ def add_html(
104104
content:str, # The HTML to send to the client (generally should include hx-swap-oob)
105105
):
106106
"Send HTML to the browser to be swapped into the DOM"
107-
res = to_xml(content)
108-
xpost('http://localhost:5001/add_html_', data=dict(content=res))
107+
xpost('http://localhost:5001/add_html_', data=dict(content=to_xml(content)))
109108

110109
# %% ../nbs/00_core.ipynb
111110
def del_msg(
@@ -149,7 +148,8 @@ def add_msg(
149148
try: json.loads(ot or '[]')
150149
except: return "Code output must be valid json"
151150
if not sid: sid = find_msg_id()
152-
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
153153
return xpost('http://localhost:5001/add_relative_', data=data).text
154154

155155
# %% ../nbs/00_core.ipynb
@@ -180,7 +180,7 @@ def _umsg(
180180
@delegates(_umsg)
181181
def update_msg(
182182
sid:str=None, # sid (stable id -- pk) of message to update (if None, uses current message)
183-
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)
184184
msg:Optional[Dict]=None, # Dictionary of field keys/values to update
185185
**kwargs):
186186
"""Update an existing message. Provide either `msg` OR field key/values to update.

dialoghelper/db_dc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ class Message:
7777
o_collapsed: int | None = '0'
7878
header_collapsed: int | None = '0'
7979
pinned: int | None = '0'
80+
use_thinking: int | None = 0
8081

8182
@dataclass
8283
class Secret:

nbs/00_core.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,7 @@
401401
" content:str, # The HTML to send to the client (generally should include hx-swap-oob)\n",
402402
"):\n",
403403
" \"Send HTML to the browser to be swapped into the DOM\"\n",
404-
" res = to_xml(content)\n",
405-
" xpost('http://localhost:5001/add_html_', data=dict(content=res))"
404+
" xpost('http://localhost:5001/add_html_', data=dict(content=to_xml(content)))"
406405
]
407406
},
408407
{
@@ -467,7 +466,8 @@
467466
" try: json.loads(ot or '[]')\n",
468467
" except: return \"Code output must be valid json\"\n",
469468
" if not sid: sid = find_msg_id()\n",
470-
" data = dict(content=content, placement=placement, sid=sid, **kwargs)\n",
469+
" data = dict(placement=placement, sid=sid, **kwargs)\n",
470+
" if content is not None: data['content'] = content\n",
471471
" return xpost('http://localhost:5001/add_relative_', data=data).text"
472472
]
473473
},
@@ -519,7 +519,7 @@
519519
"@delegates(_umsg)\n",
520520
"def update_msg(\n",
521521
" sid:str=None, # sid (stable id -- pk) of message to update (if None, uses current message)\n",
522-
" content:str|None = None, # Content of the message (i.e the message prompt, code, or note text)\n",
522+
" content:str|None=None, # Content of the message (i.e the message prompt, code, or note text)\n",
523523
" msg:Optional[Dict]=None, # Dictionary of field keys/values to update\n",
524524
" **kwargs):\n",
525525
" \"\"\"Update an existing message. Provide either `msg` OR field key/values to update.\n",

0 commit comments

Comments
 (0)