implemented basic settings into the backend, renamed files, fixed bugs, and added back button functionality

This commit is contained in:
Joshua
2024-07-10 15:36:55 -06:00
parent 5d2e162da8
commit e5b69aa2b6
9 changed files with 104 additions and 64 deletions
@@ -1,4 +1,4 @@
import 'package:app/util/server.dart';
import 'package:app/util/backend.dart';
import 'package:flutter/material.dart';
import 'chat.dart';
@@ -6,19 +6,30 @@ class Conversation with ChangeNotifier {
int conversationID;
String conversationLabel;
String conversationSubLabel;
bool history = true;
// History is disabled by default. This means chats are auto-deleted once the user exits that conversation.
bool conversationContext = true; // The prior prompts and responses are used as additional context for the next prompt and response.
late bool stream = false; // Update the UI with a stream of characters as received from the server, or as one text.
List<Chat> chats = [];
Conversation(this.conversationID, this.conversationLabel, this.conversationSubLabel);
Conversation.completeConversation(this.conversationID, this.conversationLabel, this.conversationSubLabel, this.chats);
void toggleHistory() => history = !history;
void toggleConversationContext() => conversationContext = !conversationContext;
void toggleStream() => stream = !stream;
void add(Chat message) {
chats.add(message);
notifyListeners();
}
void loadChats() {
chats = Backend.getChatsByConversationID(conversationID);
Backend.loadConversation;
chats = Backend.loadedChats;
}
void setLabel() {