mirror of
https://github.com/ParisNeo/lollms-webui.git
synced 2025-02-20 09:16:15 +00:00
Bugfix for first time db
This commit is contained in:
parent
e5926cafa0
commit
10dea92101
6
db.py
6
db.py
@ -127,7 +127,11 @@ class DiscussionsDB:
|
||||
conn.commit()
|
||||
|
||||
def load_last_discussion(self):
|
||||
last_discussion_id = self.select("SELECT id FROM discussions ORDER BY id DESC LIMIT 1", fetch_all=False)[0]
|
||||
last_discussion_id = self.select("SELECT id FROM discussions ORDER BY id DESC LIMIT 1", fetch_all=False)
|
||||
if last_discussion_id is None:
|
||||
last_discussion_id = self.create_discussion()
|
||||
else:
|
||||
last_discussion_id=last_discussion_id[0]
|
||||
return Discussion(last_discussion_id, self)
|
||||
|
||||
def create_discussion(self, title="untitled"):
|
||||
|
@ -55,8 +55,8 @@ chatForm.addEventListener('submit', event => {
|
||||
{
|
||||
// We parse it and
|
||||
infos = JSON.parse(text)
|
||||
addMessage('User', infos.message, infos.id, can_edit=true);
|
||||
elements = addMessage('GPT4ALL', '', infos.response_id, can_edit=true);
|
||||
addMessage('User', infos.message, infos.id, 0, can_edit=true);
|
||||
elements = addMessage('GPT4ALL', '', infos.response_id, 0, can_edit=true);
|
||||
messageTextElement=elements['messageTextElement'];
|
||||
hiddenElement=elements['hiddenElement'];
|
||||
entry_counter ++;
|
||||
@ -264,7 +264,7 @@ Examples:
|
||||
Welcome! I'm here to assist you with anything you need. What can I do for you today?
|
||||
`;
|
||||
|
||||
addMessage("GPT4ALL",welcome_message,0);
|
||||
addMessage("GPT4ALL",welcome_message,0,0,false);
|
||||
|
||||
// Code for collapsable text
|
||||
const collapsibles = document.querySelectorAll('.collapsible');
|
||||
|
@ -21,10 +21,9 @@
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="main" class="tab-pane absolute inset-0 border-4 border-red-500 h-full">
|
||||
<div class="absolute inset-0 border-4 border-red-500 w-1/3 bg-gray-200 flex flex-row border-r border-gray-400 h-full">
|
||||
<div class="absolute inset-0 border-4 border-red-500">
|
||||
<section class="flex-1 absolute inset-0 border-4 border-red-500 overflow-y-auto h-full">
|
||||
<div id="main" class="tab-pane flex flex-col">
|
||||
<div class="w-1/3 bg-gray-200 flex flex-row border-r border-gray-400 h-screen">
|
||||
<section>
|
||||
<section id="action-buttons" class="flex-none md:border-b border-accent flex flex-row md:flex-row">
|
||||
<button id="new-discussion-btn" class="my-1 mx-1 outline-none px-4 bg-accent text-black rounded-md hover:bg-[#7ba0ea] active:bg-[#3d73e1] transition-colors ease-in-out">
|
||||
<img src="/static/images/new_message.png" style="width: 20px;height: 20px;">
|
||||
@ -39,17 +38,23 @@
|
||||
<div>
|
||||
<h1>Discussions</h1>
|
||||
</div>
|
||||
<div id="discussions-list" class="h-96 overflow-y-auto h-full">
|
||||
<div id="discussions-list" class="overflow-y-auto h-full">
|
||||
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
<div id="chat-window" class="w-2/3 overflow-y-auto flex flex-col max-h-full">
|
||||
<div class="flex-coll w-full h-screen">
|
||||
<div id="chat-window" class="w-2/3 overflow-y-auto flex flex-col flex-1">
|
||||
|
||||
</div>
|
||||
<form id="chat-form" class="flex w-full mt-auto">
|
||||
<input type="text" id="user-input" placeholder="Type your message..." class="bg-secondary my-1 mx-1 outline-none drop-shadow-sm w-full rounded-md p-2">
|
||||
<input type="submit" value="Send" id="submit-input" class="my-1 mx-1 outline-none px-4 bg-accent text-black rounded-md hover:bg-[#7ba0ea] active:bg-[#3d73e1] transition-colors ease-in-out">
|
||||
<div id="wait-animation" style="display: none;" class="lds-facebook bg-secondary my-1 mx-1 outline-none drop-shadow-sm w-full rounded-md p-2"><div></div><div></div><div></div></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tab-pane" id="settings">
|
||||
<div class="tab-pane" id="settings" style="display: non;">
|
||||
<div class="h-96 overflow-y-auto">
|
||||
<form id="model-params-form" class="bg-white shadow-md rounded px-8 pt-6 pb-8 mb-4">
|
||||
<div class="mb-4">
|
||||
@ -94,11 +99,6 @@
|
||||
</div>
|
||||
|
||||
<footer class="border-t border-accent flex">
|
||||
<form id="chat-form" class="flex w-full">
|
||||
<input type="text" id="user-input" placeholder="Type your message..." class="bg-secondary my-1 mx-1 outline-none drop-shadow-sm w-full rounded-md p-2">
|
||||
<input type="submit" value="Send" id="submit-input" class="my-1 mx-1 outline-none px-4 bg-accent text-black rounded-md hover:bg-[#7ba0ea] active:bg-[#3d73e1] transition-colors ease-in-out">
|
||||
<div id="wait-animation" style="display: none;" class="lds-facebook bg-secondary my-1 mx-1 outline-none drop-shadow-sm w-full rounded-md p-2"><div></div><div></div><div></div></div>
|
||||
</form>
|
||||
</footer>
|
||||
<script src="{{ url_for('static', filename='js/marked.min.js') }}"></script>
|
||||
<script src="{{ url_for('static', filename='js/chat.js') }}"></script>
|
||||
|
Loading…
x
Reference in New Issue
Block a user