class_docstr: A database manager class that handles the creation and interaction with an SQLite database.
class_docstr_tok: ["A","database","manager","class","that","handles","the","creation","and","interaction","with","an","SQLite","database","."]
docstr: Initializes the DBManager object, creates a database if it does not exist, and establishes a connection.
  
  Args:
      path (str): The file path to the SQLite database file.
      **kwargs: Additional keyword arguments to pass to the sqlite3.connect method.
docstr_tok: ["Initializes","the","DBManager","object",",","creates","a","database","if","it","does","not","exist",",","and","establishes","a","connection",".","Args",":","path","(","str",")",":","The","file","path","to","the","SQLite","database","file",".","*","*","kwargs",":","Additional","keyword","arguments","to","pass","to","the","sqlite3.connect","method","."]
code: def __init__(
      self, path: str = "database.sqlite", **kwargs: Any
  ) -> None:
      """
      Initializes the DBManager object, creates a database if it does not exist, and establishes a connection.
  
      Args:
          path (str): The file path to the SQLite database file.
          **kwargs: Additional keyword arguments to pass to the sqlite3.connect method.
      """
  
      self.path = path
      # check if the database exists, if not create it
      # self.reset_db()
      if not os.path.exists(self.path):
          logger.info("Creating database")
          self.init_db(path=self.path, **kwargs)
  
      try:
          self.conn = sqlite3.connect(
              self.path, check_same_thread=False, **kwargs
          )
          self.cursor = self.conn.cursor()
      except Exception as e:
          logger.error("Error connecting to database: %s", e)
          raise e
  
imports: import json
  import logging
  import sqlite3
  import threading
  import os
  from typing import Any, List, Dict, Optional, Tuple
  from ..datamodel import AgentFlowSpec, AgentWorkFlowConfig, Gallery, Message, Session, Skill
label_desc: Use image node_id 1 to create a new DBManager object  with example: obj = DBManager(path)