mirror of
https://github.com/TeamWiseFlow/wiseflow.git
synced 2025-02-02 18:28:46 +08:00
Fix typo (#28)
This commit is contained in:
parent
4d0b993bd9
commit
a09571d4b3
@ -105,13 +105,13 @@ https://github.com/TeamWiseFlow/wiseflow/assets/96130569/bd4b2091-c02d-4457-9ec6
|
|||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
```
|
```
|
||||||
|
|
||||||
之后可以参考core/scrips 中的脚本分别启动pb、task和backend (将脚本文件移动到core目录下)
|
之后可以参考core/scripts 中的脚本分别启动pb、task和backend (将脚本文件移动到core目录下)
|
||||||
|
|
||||||
注意:
|
注意:
|
||||||
- 一定要先启动pb,task和backend是独立进程,先后顺序无所谓,也可以按需求只启动其中一个;
|
- 一定要先启动pb,task和backend是独立进程,先后顺序无所谓,也可以按需求只启动其中一个;
|
||||||
- 需要先去这里 https://pocketbase.io/docs/ 下载对应自己设备的pocketbase客户端,并放置在 /core/pb 目录下
|
- 需要先去这里 https://pocketbase.io/docs/ 下载对应自己设备的pocketbase客户端,并放置在 /core/pb 目录下
|
||||||
- pb运行问题(包括首次运行报错等)参考 [core/pb/README.md](/core/pb/README.md)
|
- pb运行问题(包括首次运行报错等)参考 [core/pb/README.md](/core/pb/README.md)
|
||||||
- 使用前请创建并编辑.env文件,放置在wiseflow代码仓根目录(core目录的上级),.evn文件可以参考env_sample,详细配置说明见下
|
- 使用前请创建并编辑.env文件,放置在wiseflow代码仓根目录(core目录的上级),.env文件可以参考env_sample,详细配置说明见下
|
||||||
|
|
||||||
|
|
||||||
📚 for developer, see [/core/README.md](/core/README.md) for more
|
📚 for developer, see [/core/README.md](/core/README.md) for more
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
from pocketbase import PocketBase # Client also works the same
|
from pocketbase import PocketBase # Client also works the same
|
||||||
from pocketbase.client import FileUpload
|
from pocketbase.client import FileUpload
|
||||||
from typing import BinaryIO
|
from typing import BinaryIO, Optional, List, Dict
|
||||||
|
|
||||||
|
|
||||||
class PbTalker:
|
class PbTalker:
|
||||||
@ -13,7 +13,7 @@ class PbTalker:
|
|||||||
self.client = PocketBase(url)
|
self.client = PocketBase(url)
|
||||||
auth = os.environ.get('PB_API_AUTH', '')
|
auth = os.environ.get('PB_API_AUTH', '')
|
||||||
if not auth or "|" not in auth:
|
if not auth or "|" not in auth:
|
||||||
self.logger.warnning("invalid email|password found, will handle with not auth, make sure you have set the collection rule by anyone")
|
self.logger.warning("invalid email|password found, will handle with not auth, make sure you have set the collection rule by anyone")
|
||||||
else:
|
else:
|
||||||
email, password = auth.split('|')
|
email, password = auth.split('|')
|
||||||
try:
|
try:
|
||||||
@ -27,7 +27,7 @@ class PbTalker:
|
|||||||
else:
|
else:
|
||||||
raise Exception("pocketbase auth failed")
|
raise Exception("pocketbase auth failed")
|
||||||
|
|
||||||
def read(self, collection_name: str, fields: list[str] = None, filter: str = '', skiptotal: bool = True) -> list:
|
def read(self, collection_name: str, fields: Optional[List[str]] = None, filter: str = '', skiptotal: bool = True) -> list:
|
||||||
results = []
|
results = []
|
||||||
for i in range(1, 10):
|
for i in range(1, 10):
|
||||||
try:
|
try:
|
||||||
@ -46,7 +46,7 @@ class PbTalker:
|
|||||||
results.append(attributes)
|
results.append(attributes)
|
||||||
return results
|
return results
|
||||||
|
|
||||||
def add(self, collection_name: str, body: dict) -> str:
|
def add(self, collection_name: str, body: Dict) -> str:
|
||||||
try:
|
try:
|
||||||
res = self.client.collection(collection_name).create(body)
|
res = self.client.collection(collection_name).create(body)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -54,7 +54,7 @@ class PbTalker:
|
|||||||
return ''
|
return ''
|
||||||
return res.id
|
return res.id
|
||||||
|
|
||||||
def update(self, collection_name: str, id: str, body: dict) -> str:
|
def update(self, collection_name: str, id: str, body: Dict) -> str:
|
||||||
try:
|
try:
|
||||||
res = self.client.collection(collection_name).update(id, body)
|
res = self.client.collection(collection_name).update(id, body)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
@ -80,7 +80,7 @@ class PbTalker:
|
|||||||
return ''
|
return ''
|
||||||
return res.id
|
return res.id
|
||||||
|
|
||||||
def view(self, collection_name: str, item_id: str, fields: list[str] = None) -> dict:
|
def view(self, collection_name: str, item_id: str, fields: Optional[List[str]] = None) -> Dict:
|
||||||
try:
|
try:
|
||||||
res = self.client.collection(collection_name).get_one(item_id, {"fields": ','.join(fields) if fields else ''})
|
res = self.client.collection(collection_name).get_one(item_id, {"fields": ','.join(fields) if fields else ''})
|
||||||
return vars(res)
|
return vars(res)
|
||||||
|
Loading…
Reference in New Issue
Block a user