-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch_doc_service.py
More file actions
43 lines (36 loc) · 1.45 KB
/
patch_doc_service.py
File metadata and controls
43 lines (36 loc) · 1.45 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
import re
with open("/home/clawncore/Desktop/colabwize/src/services/documentService.ts", "r") as f:
content = f.read()
# 1. Update Project interface
content = re.sub(
r" workspace_id\?: string;\n\}",
" workspace_id?: string;\n linked_library?: string | null;\n}",
content
)
# 2. Update uploadDocument definition
content = re.sub(
r"workspaceId\?: string,\n \): Promise<UploadResponse> \{",
"workspaceId?: string,\n linkedLibrary?: string | null,\n ): Promise<UploadResponse> {",
content
)
# 3. Update uploadDocument body
content = re.sub(
r"if \(workspaceId\) \{\n *formData\.append\(\"workspaceId\", workspaceId\);\n *\}",
"if (workspaceId) {\n formData.append(\"workspaceId\", workspaceId);\n }\n if (linkedLibrary) {\n formData.append(\"linked_library\", linkedLibrary);\n }",
content
)
# 4. Update createProject definition
content = re.sub(
r"projectId: string = \"\",\n *workspaceId\?: string,\n * \): Promise",
"projectId: string = \"\",\n workspaceId?: string,\n linkedLibrary?: string | null,\n ): Promise",
content
)
# 5. Update createProject body
content = re.sub(
r"workspace_id: workspaceId \|\| null,\n *\}\);",
"workspace_id: workspaceId || null,\n linked_library: linkedLibrary || null,\n });",
content
)
with open("/home/clawncore/Desktop/colabwize/src/services/documentService.ts", "w") as f:
f.write(content)
print("Patched documentService.ts")