fiuai-sdk-python 0.7.0__py3-none-any.whl → 0.7.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,78 +0,0 @@
1
- # -- coding: utf-8 --
2
- # Project: fiuai-world
3
- # Created Date: 2025-12-06
4
- # Author: liming
5
- # Email: lmlala@aliyun.com
6
- # Copyright (c) 2025 FiuAI
7
-
8
- from typing import Any
9
-
10
-
11
- def escape_table_name(table_name: str) -> str:
12
- """
13
- 转义 PostgreSQL 表名,处理大小写和空格
14
-
15
- PostgreSQL 中,如果表名包含大写字母、空格或特殊字符,需要用双引号包裹
16
- Frappe 的表名格式是 tab{doctype},其中 doctype 可能包含大写字母和空格
17
-
18
- Args:
19
- table_name: 表名(如 "tabContract" 或 "tabA B")
20
-
21
- Returns:
22
- str: 转义后的表名(如 '"tabContract"' 或 '"tabA B"')
23
-
24
- Example:
25
- escape_table_name("tabContract") # 返回: '"tabContract"'
26
- escape_table_name("tabA B") # 返回: '"tabA B"'
27
- escape_table_name("tabcontract") # 返回: '"tabcontract"' (统一加引号,确保安全)
28
- """
29
- if not table_name:
30
- raise ValueError("table_name 不能为空")
31
-
32
- # 确保是字符串类型
33
- if not isinstance(table_name, str):
34
- table_name = str(table_name)
35
-
36
- # 去除首尾空白
37
- table_name = table_name.strip()
38
-
39
- # 如果已经用双引号包裹,先去除
40
- if table_name.startswith('"') and table_name.endswith('"'):
41
- table_name = table_name[1:-1]
42
-
43
- # 转义双引号(如果表名中包含双引号)
44
- escaped = table_name.replace('"', '""')
45
-
46
- # 用双引号包裹(PostgreSQL 中双引号用于标识符,可以处理大小写和空格)
47
- return f'"{escaped}"'
48
-
49
-
50
- def build_frappe_table_name(doctype: str) -> str:
51
- """
52
- 构建 Frappe 格式的表名并转义
53
-
54
- Frappe 的表名格式是 tab{doctype},其中 doctype 可能包含大写字母和空格
55
-
56
- Args:
57
- doctype: 文档类型名称(如 "Contract" 或 "A B")
58
-
59
- Returns:
60
- str: 转义后的表名(如 '"tabContract"' 或 '"tabA B"')
61
-
62
- Example:
63
- build_frappe_table_name("Contract") # 返回: '"tabContract"'
64
- build_frappe_table_name("A B") # 返回: '"tabA B"'
65
- """
66
- if not doctype:
67
- raise ValueError("doctype 不能为空")
68
-
69
- # 确保是字符串类型
70
- if not isinstance(doctype, str):
71
- doctype = str(doctype)
72
-
73
- # 构建 Frappe 表名格式
74
- table_name = f"tab{doctype}"
75
-
76
- # 转义表名
77
- return escape_table_name(table_name)
78
-
@@ -1,23 +0,0 @@
1
- # -- coding: utf-8 --
2
- # Project: fiuai-world
3
- # Created Date: 2025-01-27
4
- # Author: liming
5
- # Email: lmlala@aliyun.com
6
- # Copyright (c) 2025 FiuAI
7
-
8
- from .vector import (
9
- QdrantManager,
10
- QdrantConfig,
11
- QdrantError,
12
- qdrant_manager,
13
- ContextAwareQdrantManager,
14
- )
15
-
16
- __all__ = [
17
- 'QdrantManager',
18
- 'QdrantConfig',
19
- 'QdrantError',
20
- 'qdrant_manager',
21
- 'ContextAwareQdrantManager',
22
- ]
23
-