diff --git a/llmsurgery/dlgskill.py b/llmsurgery/dlgskill.py index e9eb815..dd6c957 100644 --- a/llmsurgery/dlgskill.py +++ b/llmsurgery/dlgskill.py @@ -65,7 +65,7 @@ def set_dlg( ): "Set the current dialog file, used by these functions when `dlg` is None" global _cur_dlg - _cur_dlg = Path(fname) + _cur_dlg = Path(fname).resolve() return _cur_dlg def cur_dlg(): diff --git a/nbs/05_dlgskill.ipynb b/nbs/05_dlgskill.ipynb index c6aa230..489d67b 100644 --- a/nbs/05_dlgskill.ipynb +++ b/nbs/05_dlgskill.ipynb @@ -129,7 +129,7 @@ "):\n", " \"Set the current dialog file, used by these functions when `dlg` is None\"\n", " global _cur_dlg\n", - " _cur_dlg = Path(fname)\n", + " _cur_dlg = Path(fname).resolve()\n", " return _cur_dlg\n", "\n", "def cur_dlg():\n", @@ -505,7 +505,18 @@ "execution_count": null, "id": "dfcaa924", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "174f46e0:p:Double it. ⇒ reply(13)" + ] + }, + "execution_count": null, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "rows = find_msgs('42', dlg=tdir/'demo.ipynb', context=0)\n", "test_eq([r.id for r in rows], [ask.id])\n", @@ -1069,6 +1080,18 @@ "assert 'kind=\"system\"' in str(xd.view()) # tagged raws are badged, never shown as ordinary content" ] }, + { + "cell_type": "code", + "execution_count": null, + "id": "caf28e42", + "metadata": {}, + "outputs": [], + "source": [ + "with working_directory(tdir):\n", + " set_dlg('demo.ipynb')\n", + " with working_directory('/'): assert cur_dlg() is not None # registration survives later cwd changes" + ] + }, { "cell_type": "code", "execution_count": null, @@ -1137,7 +1160,18 @@ "execution_count": null, "id": "bbaf5997", "metadata": {}, - "outputs": [], + "outputs": [ + { + "data": { + "text/plain": [ + "9b80fe7c:c:x = 21\\n\\nx*2" + ] + }, + "execution_count": null, + "metadata": {}, + "output_type": "execute_result" + } + ], "source": [ "s1, s2 = split_msg(calc.id, 2)\n", "test_eq(read_ipynb(tdir/'demo.ipynb').msg(s2).content, 'x*2')\n", @@ -1195,7 +1229,16 @@ ] } ], - "metadata": {}, + "metadata": { + "solveit": { + "default_code": true, + "math_mode": 1, + "mode": "learning", + "use_thinking": false, + "use_tools": true, + "ver": 2 + } + }, "nbformat": 4, "nbformat_minor": 5 }