Skip to content

[Discuss]: Pages Kit 页面模板消费 AIGNE 返回数据的一些问题 #1744

Description

@lban2049

Discuss topic

目前在 content-farm 项目中组合 Pages kit 页面模板和 AIGNE ,消费 AIGNE 的数据有一些问题。

1、如何让 AIGNE 返回指定结构的数据

现在 AIGNE 支持的方式需要在 output 里维护返回对象的结构,如果类型比较复杂,用户体验会比较差

Image

我现在的用法是通过 prompt 控制返回指定结构的数据,这种方式有两个问题:

  • 完全由大语言模型来返回结构,可能会出现误差
  • 返回的数据是 string ,使用前需要反序列化

2、图片生成的返回结构如何更简单

目前的结构是:

{
  "$images": [
    {
      "url": "https://staging.aigne.io/image-bin/uploads/403e35c955f33b3869373bd5661dfcac.png"
    }
  ]
}

使用的时候需要从数组中获取,不太自然。

3、stream 流方式调用 AIGNE 接口,返回结果没有类型提示

value 中能看到 AIGNE 中配置的 output

Image

但是取值需要从 value.delta 中获取,delta 是 any 类型

Image

Screenshots

No response

Useful Links

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions