Skip to content

Commit a9c2818

Browse files
committed
allow system prompt env; fix textual interface issues
1 parent 502655a commit a9c2818

2 files changed

Lines changed: 10 additions & 5 deletions

File tree

oneping/interface/textual.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ def __init__(self, chat, store=None, **kwargs):
256256

257257
def compose(self):
258258
yield Header(id='header')
259-
yield Sidebar(convo=self.store.convo)
259+
if self.store is not None:
260+
yield Sidebar(convo=self.store.convo)
260261
yield ChatWindow(self.chat.stream_async, system=self.chat.system)
261262

262263
def on_mount(self):
@@ -268,7 +269,9 @@ def action_toggle_sidebar(self):
268269
self.show_sidebar = not self.show_sidebar
269270

270271
def watch_show_sidebar(self, show_sidebar):
271-
self.query_one(Sidebar).set_class(show_sidebar, "-visible")
272+
if self.store is not None:
273+
sidebar = self.query_one(Sidebar)
274+
sidebar.set_class(show_sidebar, "-visible")
272275

273276
# textual powered chat interface
274277
def main(store=None, **kwargs):

oneping/providers.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
# default arguments
22

3-
from .utils import load_image_uri, parse_image_uri
3+
import os
4+
5+
from .utils import parse_image_uri
46

57
##
68
## system prompt
79
##
810

9-
DEFAULT_SYSTEM = 'You are a helpful and knowledgeable AI assistant. Answer the queries provided to the best of your ability.'
10-
DEFAULT_MAX_TOKENS = 1024
11+
DEFAULT_SYSTEM = os.environ.get('ONEPING_SYSTEM', None)
12+
DEFAULT_MAX_TOKENS = int(os.environ.get('ONEPING_MAX_TOKENS', 1024))
1113

1214
##
1315
## models

0 commit comments

Comments
 (0)