first commit

This commit is contained in:
MoonDev
2025-05-04 16:30:07 +03:00
commit 0ef49fade8
4 changed files with 75 additions and 0 deletions

Binary file not shown.

33
misc/conversations.py Normal file
View File

@@ -0,0 +1,33 @@
from random_string import generate_secure_string
CONVERSATIONS = {}
"""
{
messages:
[{
role:str,
content:str,
id:int
}],
last_message_id: int,
workspace: str,
user_name: str,
problem_type: int
}
"""
class Conversations:
def __init__(self):
self.id = ""
def create(self,user_message,workspace,user_name,problem_type):
self.id = generate_secure_string(40)
CONVERSATIONS[self.id] = {
"messages":[],
"last_message_id":0,
"workspace":workspace,
"user_name":user_name,
"problem_type":problem_type}
return CONVERSATIONS[self.id]

10
misc/random_string.py Normal file
View File

@@ -0,0 +1,10 @@
import secrets
import string
def generate_secure_string(length):
if length <= 0:
return ""
characters = string.ascii_letters + string.digits
return ''.join(secrets.choice(characters) for _ in range(length))