MCPcopy
hub / github.com/PromtEngineer/localGPT / create_session

Method create_session

backend/database.py:108–122  ·  view source on GitHub ↗

Create a new chat session

(self, title: str, model: str)

Source from the content-addressed store, hash-verified

106 print("✅ Database initialized successfully")
107
108 def create_session(self, title: str, model: str) -> str:
109 """Create a new chat session"""
110 session_id = str(uuid.uuid4())
111 now = datetime.now().isoformat()
112
113 conn = sqlite3.connect(self.db_path)
114 conn.execute('''
115 INSERT INTO sessions (id, title, created_at, updated_at, model_used)
116 VALUES (?, ?, ?, ?, ?)
117 ''', (session_id, title, now, now, model))
118 conn.commit()
119 conn.close()
120
121 print(f"📝 Created new session: {session_id[:8]}... - {title}")
122 return session_id
123
124 def get_sessions(self, limit: int = 50) -> List[Dict]:
125 """Get all chat sessions, ordered by most recent"""

Callers 2

database.pyFile · 0.80
handle_create_sessionMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected