release v2.0.9:exec 线彻底不传数据(删掉三处偷偷留的回退)
This commit is contained in:
@@ -30,8 +30,8 @@ android {
|
||||
* versionCode 每次发版 +1(Android 靠它判断"能不能覆盖安装",
|
||||
* 改小了会装不上)。
|
||||
*/
|
||||
versionCode = 208
|
||||
versionName = "2.0.8"
|
||||
versionCode = 209
|
||||
versionName = "2.0.9"
|
||||
|
||||
ndk {
|
||||
// Chaquopy 只支持这两个;Termux bootstrap 也只准备了这两份
|
||||
|
||||
@@ -58,7 +58,7 @@ NODE_TYPES = ('start', 'agent', 'judge', 'end', 'var', 'readvar', 'while', 'valu
|
||||
# return "结果"
|
||||
#
|
||||
# ctx 提供:
|
||||
# ctx.input 上游传进来的内容(数据线优先,没有就用 exec 上游的输出)
|
||||
# ctx.input 上游**数据线**传进来的内容(exec 线不传数据,永远不)
|
||||
# ctx.vars 变量表(**只读快照**,改它不会影响会议)
|
||||
# ctx.set_var(名, 值) 写变量(会真的写进会议变量表)
|
||||
# ctx.log(内容) 记一条说明,会出现在结果界面的这一步里
|
||||
@@ -1062,8 +1062,14 @@ def _outgoing(edges: list, node_id: str) -> list:
|
||||
# - 读变量这种"纯节点"(Get)**没有 exec 引脚**,它的值是被需要的人
|
||||
# **拉取**的,自己不在执行链上 —— 这正是"读变量只有输出"的真正原因。
|
||||
#
|
||||
# 兼容:老会议里没有 kind 字段的边,当成 exec 处理,并且"没有数据入边时
|
||||
# 就用 exec 上游的输出"当输入 —— 这样以前那种"一根线连到底"的图行为不变。
|
||||
# ★★ exec **不传数据** —— 这是**写死**的规则,没有例外、没有兼容回退。
|
||||
#
|
||||
# 一开始为了迁就"一根线连到底"的老图,做过"没有数据入边时就用 exec 上游的
|
||||
# 输出"的回退。那是错的:它让 exec 线看起来能传值,于是**整张图的类型就不
|
||||
# 再有意义** —— 用户没法从图上判断一个值到底从哪来,界面画的颜色和形状
|
||||
# 也都在骗人。宁可让空值显式地空着(节点上会报原因),也不要猜。
|
||||
#
|
||||
# 兼容:老会议里没有 kind 字段的边,当成 exec 处理。
|
||||
|
||||
EXEC = 'exec'
|
||||
DATA = 'data'
|
||||
@@ -1586,24 +1592,16 @@ def run_meeting(*, meeting: dict, settings: dict, user_input: str,
|
||||
value = (node.get('varValue') or '').strip()
|
||||
note = ''
|
||||
if not value:
|
||||
# ★★ exec **绝不传数据** —— 这条是**写死**的,没有例外。
|
||||
#
|
||||
# 这里以前有个"没连数据线就用 exec 上游的输出"的回退。
|
||||
# 那是错的,而且错得很危险:它让"exec 线"看起来能传值,
|
||||
# 于是整个类型系统就不可信了 —— 用户没法从图上判断
|
||||
# 一个值到底从哪来。蓝图里 exec 就是**只排顺序**。
|
||||
#
|
||||
# 没连数据线就是**空**,节点上会明确报出来
|
||||
# (见下面 _exec_in 那段 warn 的逻辑)。
|
||||
value = incoming
|
||||
# ★ **没连数据线时,退一步用 exec 上游的输出。**
|
||||
#
|
||||
# "exec 不传递数据"这条规则是对的,但对**写变量**太苛刻:
|
||||
# 用户的心智模型就是"这根线连过来了,所以把刚才产生的东西存进去"。
|
||||
# 逼他们必须再拉一根数据线,结果就是反复踩同一个坑
|
||||
# (这个问题被反馈了三次)。
|
||||
#
|
||||
# 所以做一个**有交代的例外**:没数据线就用 exec 上游的输出,
|
||||
# 并且在节点上明确写出来"用了上游的输出" ——
|
||||
# 不是悄悄猜,用户一眼能看到引擎替他做了什么。
|
||||
if not _data_in(edges, node_id):
|
||||
ups = [outputs.get(e.get('from'))
|
||||
for e in _exec_in(edges, node_id)]
|
||||
ups = [t for t in ups if t]
|
||||
if ups:
|
||||
value = ups[-1]
|
||||
note = '(没连数据线,用了 exec 上游的输出)'
|
||||
# ★ **按变量类型决定动作**。
|
||||
#
|
||||
# 列表 → 默认**追加**:列表的用处就是攒东西,"写变量"这个动作
|
||||
@@ -1683,17 +1681,9 @@ def run_meeting(*, meeting: dict, settings: dict, user_input: str,
|
||||
continue
|
||||
ins[pin['name']] = _collect_pin_input(
|
||||
node_id, edges, pin, d, outputs, variables, by_id)
|
||||
# 没连任何入口时,退一步用 exec 上游的输出喂给**第一个**入口 ——
|
||||
# 和写变量、最终输出一个道理:用户的心智是"线连过来了",
|
||||
# 逼他必须再拉一根数据线只会让他看到空值还不知道为什么。
|
||||
if not any(str(v).strip() for v in ins.values()):
|
||||
data_pins = [p for p in (d.get('inputs') or []) if p['type'] != 'exec']
|
||||
if data_pins and not _data_in(edges, node_id):
|
||||
ups = [outputs.get(e.get('from'))
|
||||
for e in _exec_in(edges, node_id)]
|
||||
ups = [t for t in ups if t]
|
||||
if ups:
|
||||
ins[data_pins[0]['name']] = ups[-1]
|
||||
# ★ exec 不传数据(写死的规则,没有例外)——
|
||||
# 这里以前也有个"没连入口就用 exec 上游的输出"的回退,已删。
|
||||
# 自定义节点的入口收不到值就是空的,节点上会报出来。
|
||||
logs = []
|
||||
outs, err = _cn.run_custom(d, ins, variables, node, logs)
|
||||
if err:
|
||||
@@ -1823,16 +1813,11 @@ def run_meeting(*, meeting: dict, settings: dict, user_input: str,
|
||||
# 展示方式不同。所以每个 end 节点都把自己那份结果和类型记下来。
|
||||
value = (node.get('text') or '').strip()
|
||||
if not value:
|
||||
# ★ exec 不传数据(写死的规则,没有例外)——
|
||||
# 只连了 exec 线时这里就是空的。以前有个"用 exec 上游
|
||||
# 输出"的回退,已删:它让 exec 看起来能传值,
|
||||
# 整张图的类型就不再有意义了。
|
||||
value = incoming
|
||||
# 和"写变量"同样的道理:只连了 exec 线时,用上游的输出。
|
||||
# 用户的心智模型是"这根线连过来了,所以把刚才产生的东西显示出来",
|
||||
# 逼他必须再拉一根数据线,只会让他看到一片空白还不知道为什么。
|
||||
if not _data_in(edges, node_id):
|
||||
ups = [outputs.get(e.get('from'))
|
||||
for e in _exec_in(edges, node_id)]
|
||||
ups = [t for t in ups if t]
|
||||
if ups:
|
||||
value = ups[-1]
|
||||
outputs[node_id] = value
|
||||
# 类型:**优先看来源节点的实际出口类型**,不要信边上的 kind。
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user