Last commit before UI redesign
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
class ChatSettings():
|
||||
def __init__(self):
|
||||
self.num_gpu: int = 15
|
||||
self.low_vram: bool = False
|
||||
self.num_thread: int = 0
|
||||
self.temperature: int = 1.0
|
||||
self.system_prompt: str = None
|
||||
|
||||
def convert_to_ollama(self):
|
||||
return {
|
||||
"num_gpu": self.num_gpu,
|
||||
"low_vram": self.low_vram,
|
||||
"num_thread": self.num_thread,
|
||||
"temperature": self.temperature,
|
||||
}
|
||||
|
||||
class ChatSession():
|
||||
def __init__(self, model_name):
|
||||
self.model_name: str = model_name
|
||||
self.history = []
|
||||
self.settings: ChatSettings = ChatSettings()
|
||||
|
||||
def push_history(self, text: str, role: str = "user"):
|
||||
if not self.history or self.history[-1]["role"] != role:
|
||||
self.history.append({"role": role, "content": text})
|
||||
else:
|
||||
self.history[-1]["content"] += text
|
||||
|
||||
Reference in New Issue
Block a user