Skip to content

Commit

Permalink
Improve switching between regular and OpenSesame-expert mode
Browse files Browse the repository at this point in the history
  • Loading branch information
smathot committed Apr 17, 2024
1 parent ef3e5e4 commit 94a8c5e
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 12 deletions.
16 changes: 4 additions & 12 deletions heymans/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,12 @@
# The maximum length of a user message
max_message_length = 5000
# A fixed welcome message
welcome_message_with_search = '''Nice to meet you! I am Sigmund, your friendly OpenSesame assistant! I am best at answering questions that are specific and that I can look up in the documentation.
welcome_message_with_search = '''Nice to meet you! I am Sigmund, your friendly OpenSesame assistant! How can I help you?
If you want to discuss things that are unrelated to OpenSesame, disable "OpenSesame expert" mode in the menu (it is currently enabled). That will make me a better general-purpose chatbot.
<div class="message-notification">I am currently functioning as an OpenSesame expert. If you want to discuss things that are not related to OpenSesame, <a href="/api/conversation/new/without_search">click here</a> to turn me into a regular chatbot.</div>'''
welcome_message_without_search = '''Nice to meet you! I am Sigmund, your friendly AI assistant! What would you like to discuss?
Let\'s get started! What would like you to disuss?
'''
welcome_message_without_search = '''Nice to meet you! I am Sigmund, your friendly AI assistant!
I have basic code execution abilities, I can read attachments, I can download files from the internat, and I can look up scientific articles on Google Scholar.
If you want help with OpenSesame, enable "OpenSesame expert" mode in the menu (it is currently disabled). That will give me access to the OpenSesame documentation.
Let\'s get started! What would like you to disuss?
'''
<div class="message-notification">I am currently functioning as a regular chatbot, who can do <a href="/about">lots of things</a>. However, I cannot read the OpenSesame documentation while in this mode. If you want help with OpenSesame, <a href="/api/conversation/new/with_search">click here</a> to turn me into an OpenSesame expert.</div>'''
# The default title of a new conversation
default_conversation_title = 'New conversation'
# The number of previous messages for which tool results should be
Expand Down
18 changes: 18 additions & 0 deletions heymans/routes/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,24 @@ def new_conversation():
heymans = get_heymans()
heymans.database.new_conversation()
return redirect('/chat')


@api_blueprint.route('/conversation/new/with_search')
@login_required
def new_conversation_with_search():
heymans = get_heymans()
heymans.database.set_setting('search_first', 'true')
heymans.database.new_conversation()
return redirect('/chat')


@api_blueprint.route('/conversation/new/without_search')
@login_required
def new_conversation_without_search():
heymans = get_heymans()
heymans.database.set_setting('search_first', 'false')
heymans.database.new_conversation()
return redirect('/chat')


@api_blueprint.route('/conversation/clear')
Expand Down
8 changes: 8 additions & 0 deletions heymans/templates/stylesheet.css.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -390,3 +390,11 @@ button#start {
overflow-y: auto;
background-color: #cfd8dc;
}

.message .message-notification {
border-top: solid 1px #90A4AE;
padding-top: 10px;
padding-bottom: 10px;
color: #90A4AE;
font-size: .8em;
}

0 comments on commit 94a8c5e

Please sign in to comment.