We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4265077 commit facbe04Copy full SHA for facbe04
examples/live_updates/main.py
@@ -1,16 +1,9 @@
1
-import dataclasses
2
import datetime
3
4
import cocoindex
5
from dotenv import load_dotenv
6
7
8
-@dataclasses.dataclass
9
-class Document:
10
- filename: str
11
- content: str
12
-
13
14
@cocoindex.flow_def(name="LiveUpdates")
15
def live_update_flow(
16
flow_builder: cocoindex.FlowBuilder, data_scope: cocoindex.DataScope
@@ -49,7 +42,10 @@ def main():
49
42
print("Live updater started. Watching for changes in the 'data' directory.")
50
43
print("Try adding, modifying, or deleting files in the 'data' directory.")
51
44
print("Press Ctrl+C to stop.")
52
- updater.wait()
45
+ try:
46
+ updater.wait()
47
+ except KeyboardInterrupt:
48
+ print("Stopping live updater...")
53
54
55
if __name__ == "__main__":
0 commit comments