|
197 | 197 | " msg_type:str=None, # optional limit by message type ('code', 'note', or 'prompt')\n", |
198 | 198 | " limit:int=None, # Optionally limit number of returned items\n", |
199 | 199 | " include_output:bool=True # Include output in returned dict?\n", |
200 | | - "):\n", |
201 | | - " \"Find messages in current specific dialog that contain the given information. To refer to a message found later, use its `sid` field (which is the pk).\"\n", |
| 200 | + ")->list[dict]:\n", |
| 201 | + " \"Find `list[dict]` of messages in current specific dialog that contain the given information. To refer to a message found later, use its `sid` field (which is the pk).\"\n", |
202 | 202 | " did = find_dialog_id()\n", |
203 | 203 | " db = get_db()\n", |
204 | 204 | " res = db.t.message('did=? AND content LIKE ? ORDER BY mid', [did, f'%{pattern}%'], limit=limit)\n", |
|
297 | 297 | "outputs": [], |
298 | 298 | "source": [ |
299 | 299 | "#| export\n", |
300 | | - "def read_msg_ids():\n", |
| 300 | + "def read_msg_ids()->list[str]:\n", |
301 | 301 | " \"Get all ids in current dialog.\"\n", |
302 | 302 | " did = find_dialog_id()\n", |
303 | 303 | " db = get_db()\n", |
|
348 | 348 | "def read_msg(n:int=-1, # Message index (if relative, +ve is downwards)\n", |
349 | 349 | " relative:bool=True # Is `n` relative to current message (True) or absolute (False)?\n", |
350 | 350 | " ):\n", |
351 | | - " \"Get the message indexed in the current dialog.\"\n", |
| 351 | + " \"Get the `Message` object indexed in the current dialog.\"\n", |
352 | 352 | " ids,idx = msg_idx()\n", |
353 | 353 | " if relative:\n", |
354 | 354 | " idx = idx+n\n", |
|
462 | 462 | "):\n", |
463 | 463 | " \"\"\"Add/update a message to the queue to show after code execution completes, and optionally run it. Be sure to pass a `sid` (stable id) not a `mid` (which is used only for sorting, and can change).\n", |
464 | 464 | " *WARNING*--This can execute arbitrary code, so check carefully what you run!--*WARNING\"\"\"\n", |
465 | | - " add_msg(content=content, run=run, **kwargs)" |
| 465 | + " return add_msg(content=content, run=run, **kwargs)" |
466 | 466 | ] |
467 | 467 | }, |
468 | 468 | { |
|
0 commit comments