Repository navigation
Expand file tree
/
Copy pathmain.py
More file actions
60 lines (49 loc) · 1.38 KB
/
Copy pathmain.py
File metadata and controls
60 lines (49 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
from cli.command_group import cli
from cli.commands import (
collections,
conversations,
database,
documents,
graphs,
indices,
prompts,
retrieval,
system,
users,
)
from cli.utils.telemetry import posthog, telemetry
def add_command_with_telemetry(command):
cli.add_command(telemetry(command))
# Chunks
add_command_with_telemetry(collections.collections)
add_command_with_telemetry(conversations.conversations)
add_command_with_telemetry(documents.documents)
add_command_with_telemetry(graphs.graphs)
# Graph
add_command_with_telemetry(indices.indices)
add_command_with_telemetry(prompts.prompts)
add_command_with_telemetry(retrieval.retrieval)
add_command_with_telemetry(users.users)
add_command_with_telemetry(system.system)
# Database
add_command_with_telemetry(database.db)
add_command_with_telemetry(database.upgrade)
add_command_with_telemetry(database.downgrade)
add_command_with_telemetry(database.current)
add_command_with_telemetry(database.history)
def main():
try:
cli()
except SystemExit:
# Silently exit without printing the traceback
pass
except Exception as e:
# Handle other exceptions if needed
raise e
finally:
# Ensure all events are flushed before exiting
if posthog:
posthog.flush()
posthog.shutdown()
if __name__ == "__main__":
main()