aicode/kdb/design.md
2025-12-11 20:24:41 +08:00

37 lines
1.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

## ui, dspy可以直接使用的变量
### request
aiohttp.Request实例每个客户端请求有一个独立的Request实例
request._run_ns可以获得所有在.ui和.dspy源码中可以使用的变量通过ahserver.ServerEnv 传递
### params_kw
DictObjectdict子类, 支持a.b方式获取属性实例接收到客户端传来的数据如果有文件>文件都保存在服务器指定的位置params_kw中属性名保存的是其相对路径可用FileStorage().realPath(params_kw.myfile)来获得文件在服务器中的实际路径。
### get_user()
来自rbac模块协程函数获得当前登录用户如果用户没有登录返回None
### get_userorgid()
来自rbac模块协程函数获得当前登录用户的机构id如果用户没有登录返回None
## pyproject.toml和README.md
编写pyproject.toml文件和README.md文件
## 模块中使用的编码
模块中如果用到编码编码需保存在appbase模块的appcodes表和appcodes_kv两个表中
appcodes(编码表)有如下字段:
[
"id" # str 32 主键,可设置为数据表字段名称
"name" # 编码名称
"hierarchy_flg", # str 1, '0':单级编码“1”:多级编码
]
appcodes_kv编码键值表字段如下
[
"id", # str, 32,主键,唯一值
"parentid" # str, 32, 一级编码为appcodes表的id, 否则为上级编码键值记录的id
“k" # str 32, 编码值
“v” “ str 255,编码显示文本
]