|
1 | 1 | # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb. |
2 | 2 |
|
3 | 3 | # %% auto #0 |
4 | | -__all__ = ['dname_doc', 'md_cls_d', 'dh_settings', 'pyrun', 'Placements', 'mermaid_url', 'msg_insert_line', 'file_insert_line', |
| 4 | +__all__ = ['dname_doc', 'md_cls_d', 'dh_settings', 'Placements', 'mermaid_url', 'msg_insert_line', 'file_insert_line', |
5 | 5 | 'msg_str_replace', 'file_str_replace', 'msg_strs_replace', 'file_strs_replace', 'msg_replace_lines', |
6 | 6 | 'file_replace_lines', 'msg_del_lines', 'file_del_lines', 'msg_pyrun', 'file_pyrun', 'msg_ast_replace', |
7 | 7 | 'file_ast_replace', 'add_styles', 'find_dname', 'xposta', 'xgeta', 'call_endp', 'call_endpa', 'curr_dialog', |
|
37 | 37 | from toolslm.xml import * |
38 | 38 | from fasthtml.common import * |
39 | 39 | from fasthtml.components import Solveit_input |
40 | | -from lisette.core import ToolResponse |
| 40 | +from lisette.core import ToolResponse,FullResponse,StopResponse |
41 | 41 | from urllib.parse import urlencode |
42 | 42 | from fastcore.imports import __llmtools__ |
43 | | -from safepyrun import RunPython,allow,find_var,create_pyrun_magic |
| 43 | +from safepyrun import RunPython,allow,find_var,create_pyrun_magic,load_ipython_extension |
44 | 44 |
|
45 | 45 | # %% ../nbs/00_core.ipynb #e54b45ad |
46 | 46 | dname_doc = """If `dname` is None, the current dialog is used. If it is an open dialog, it will be updated interactively with real-time updates to the browser. If it is a closed dialog, it will be updated on disk. Dialog names must be paths relative to solveit root (if starting with `/`, e.g. `/myproject/dlg`) or relative to the current dialog's folder (if not starting with `/`), and should *not* include the .ipynb extension. **Use absolute paths when targeting dialogs outside the current dialog's folder tree.**""" |
@@ -68,10 +68,13 @@ def add_styles(s:str, cls_map:dict=None): |
68 | 68 | dh_settings = {'port':5001} |
69 | 69 | # dh_settings = {'port':6001} |
70 | 70 |
|
71 | | -# %% ../nbs/00_core.ipynb #6e5226c1 |
72 | | -pyrun = RunPython(sentinel='__dialog_name') |
73 | | -try: create_pyrun_magic(get_ipython(), pyrun=pyrun) |
| 71 | +# %% ../nbs/00_core.ipynb #f5cd76ed |
| 72 | +try: load_ipython_extension(get_ipython()) |
74 | 73 | except NameError: pass |
| 74 | + |
| 75 | +# pyrun = RunPython(sentinel='__dialog_name') |
| 76 | +# try: create_pyrun_magic(get_ipython(), pyrun=pyrun) |
| 77 | +# except NameError: pass |
75 | 78 | __llmtools__.add('pyrun') |
76 | 79 |
|
77 | 80 | # %% ../nbs/00_core.ipynb #65a8b58b |
@@ -453,11 +456,12 @@ async def del_msg( |
453 | 456 | # %% ../nbs/00_core.ipynb #30e90bf9 |
454 | 457 | async def run_and_prompt( |
455 | 458 | code: str, # Python code to run |
456 | | - prompt: str = ".", # Prompt to add after code execution |
| 459 | + prompt: str = "Continue.", # Prompt to add after code execution |
457 | 460 | ) -> str: |
458 | 461 | "Run `code` and then run `prompt`, returning the resulting message ID." |
459 | 462 | id = await add_msg(code, msg_type="code", run=True) |
460 | | - return await add_msg(prompt, msg_type="prompt", run=True, id=id) |
| 463 | + await add_msg(prompt, msg_type="prompt", run=True, id=id) |
| 464 | + return StopResponse('Code has been added and queued for execution. Tool loop is finishing now. Summarize progress so far and planned next steps, and await "Continue." prompt.') |
461 | 465 |
|
462 | 466 | # %% ../nbs/00_core.ipynb #023dcb74 |
463 | 467 | def _umsg( |
|
0 commit comments