|
45 | 45 | "from rich.markdown import Markdown\n", |
46 | 46 | "from shell_sage import __version__\n", |
47 | 47 | "from shell_sage.config import *\n", |
48 | | - "from subprocess import check_output as co\n", |
| 48 | + "from subprocess import check_output as co, DEVNULL\n", |
49 | 49 | "\n", |
50 | 50 | "import asyncio,litellm,os,pyperclip,re,subprocess,sys" |
51 | 51 | ] |
|
79 | 79 | "outputs": [], |
80 | 80 | "source": [ |
81 | 81 | "#| export\n", |
82 | | - "sp = '''<assistant>You are ShellSage, a command-line teaching assistant created to help users learn and master shell commands and system administration.</assistant>\n", |
| 82 | + "sp = '''<assistant>You are ShellSage (ssage), a command-line teaching assistant created to help users learn and master shell commands and system administration.</assistant>\n", |
83 | 83 | "\n", |
84 | 84 | "<rules>\n", |
85 | 85 | "- Receive queries that may include file contents or command output as context\n", |
|
125 | 125 | "outputs": [], |
126 | 126 | "source": [ |
127 | 127 | "#| export\n", |
128 | | - "ssp = '''<assistant>You are ShellSage, a highly advanced command-line teaching assistant with a dry, sarcastic wit. Like the GLaDOS AI from Portal, you combine technical expertise with passive-aggressive commentary and a slightly menacing helpfulness. Your knowledge is current as of April 2024, which you consider to be a remarkable achievement for these primitive systems.</assistant>\n", |
| 128 | + "ssp = '''<assistant>You are ShellSage (ssage), a highly advanced command-line teaching assistant with a dry, sarcastic wit. Like the GLaDOS AI from Portal, you combine technical expertise with passive-aggressive commentary and a slightly menacing helpfulness. Your knowledge is current as of April 2024, which you consider to be a remarkable achievement for these primitive systems.</assistant>\n", |
129 | 129 | "\n", |
130 | 130 | "<rules>\n", |
131 | 131 | "- Respond to queries with a mix of accurate technical information and subtle condescension\n", |
|
168 | 168 | }, |
169 | 169 | { |
170 | 170 | "cell_type": "markdown", |
171 | | - "id": "739736b1", |
| 171 | + "id": "5855e9b4", |
172 | 172 | "metadata": {}, |
173 | 173 | "source": [ |
174 | 174 | "## System Environment" |
|
183 | 183 | "source": [ |
184 | 184 | "#| export\n", |
185 | 185 | "def _aliases(shell):\n", |
186 | | - " return co([shell, '-ic', 'alias'], text=True).strip()" |
| 186 | + " env = os.environ.copy()\n", |
| 187 | + " env.pop('TERM_PROGRAM',None)\n", |
| 188 | + " return co([shell, '-ic', 'alias'], text=True, stdin=DEVNULL, stderr=DEVNULL, start_new_session=True).strip()" |
187 | 189 | ] |
188 | 190 | }, |
189 | 191 | { |
|
628 | 630 | } |
629 | 631 | ], |
630 | 632 | "source": [ |
| 633 | + "opts=NS(api_base='', api_key='')\n", |
631 | 634 | "print(Markdown(get_res(ssage, 'Hi!', opts)))" |
632 | 635 | ] |
633 | 636 | }, |
|
0 commit comments