MCPcopy Create free account
hub / github.com/101dotxyz/GPTeam / create

Method create

src/utils/database/sqlite.py:188–307  ·  view source on GitHub ↗
(cls)

Source from the content-addressed store, hash-verified

186
187 @classmethod
188 async def create(cls):
189 cls.client = await aiosqlite.connect("database.db")
190 cls.documents = []
191 cls.vector_db = HyperDB(cls.documents, key="embedding_text")
192 try:
193 if isfile("vectors.pickle.gz"):
194 cls.vector_db.load("vectors.pickle.gz")
195 except:
196 cls.documents = []
197 cls.vector_db = HyperDB(cls.documents, key="embedding_text")
198 pass
199
200 await cls.client.execute(
201 """
202 CREATE TABLE IF NOT EXISTS worlds (
203 id TEXT PRIMARY KEY,
204 name TEXT
205 )
206 """
207 )
208 await cls.client.execute(
209 """
210 CREATE TABLE IF NOT EXISTS locations (
211 id TEXT PRIMARY KEY,
212 name TEXT,
213 world_id TEXT,
214 available_tools TEXT,
215 description TEXT,
216 channel_id TEXT,
217 allowed_agent_ids TEXT,
218 FOREIGN KEY (world_id) REFERENCES worlds (id)
219 )
220 """
221 )
222 await cls.client.execute(
223 """
224 CREATE TABLE IF NOT EXISTS agents (
225 id TEXT PRIMARY KEY,
226 full_name TEXT,
227 private_bio TEXT,
228 public_bio TEXT,
229 authorized_tools TEXT,
230 directives TEXT,
231 last_checked_events TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
232 ordered_plan_ids TEXT,
233 location_id TEXT,
234 discord_bot_token TEXT,
235 world_id TEXT,
236 FOREIGN KEY (world_id) REFERENCES worlds (id),
237 FOREIGN KEY (location_id) REFERENCES locations (id)
238 )
239 """
240 )
241 await cls.client.execute(
242 """
243 CREATE TABLE IF NOT EXISTS plans (
244 id TEXT PRIMARY KEY,
245 created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,

Callers 2

inbound_messageFunction · 0.45
get_databaseFunction · 0.45

Calls 1

executeMethod · 0.80

Tested by

no test coverage detected