Skip to content

Commit

Permalink
增加json-repair
Browse files Browse the repository at this point in the history
  • Loading branch information
svcvit committed Nov 20, 2024
1 parent 03d5c50 commit 13fc533
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 0 deletions.
142 changes: 142 additions & 0 deletions DSL/json-repair.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
app:
description: ''
icon: 🤖
icon_background: '#FFEAD5'
mode: workflow
name: json-repair
use_icon_as_answer_icon: false
kind: app
version: 0.1.2
workflow:
conversation_variables: []
environment_variables: []
features:
file_upload:
image:
enabled: false
number_limits: 3
transfer_methods:
- local_file
- remote_url
opening_statement: ''
retriever_resource:
enabled: true
sensitive_word_avoidance:
enabled: false
speech_to_text:
enabled: false
suggested_questions: []
suggested_questions_after_answer:
enabled: false
text_to_speech:
enabled: false
language: ''
voice: ''
graph:
edges:
- data:
isInIteration: false
sourceType: start
targetType: code
id: 1732007415808-source-1732007419308-target
source: '1732007415808'
sourceHandle: source
target: '1732007419308'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: code
targetType: end
id: 1732007419308-source-1732007423290-target
source: '1732007419308'
sourceHandle: source
target: '1732007423290'
targetHandle: target
type: custom
zIndex: 0
nodes:
- data:
desc: ''
selected: false
title: 开始
type: start
variables:
- label: llm_string
max_length: 10000
options: []
required: true
type: paragraph
variable: llm_string
height: 90
id: '1732007415808'
position:
x: 80
y: 282
positionAbsolute:
x: 80
y: 282
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
code: "import json_repair\nimport json\n\ndef main(llm_string):\n new_string\
\ = json_repair.repair_json(llm_string, ensure_ascii=False)\n return\
\ {\n \"result\": new_string\n }\n"
code_language: python3
desc: ''
outputs:
result:
children: null
type: string
selected: true
title: 代码执行
type: code
variables:
- value_selector:
- '1732007415808'
- llm_string
variable: llm_string
height: 54
id: '1732007419308'
position:
x: 384
y: 282
positionAbsolute:
x: 384
y: 282
selected: true
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
desc: ''
outputs:
- value_selector:
- '1732007419308'
- result
variable: output
selected: false
title: 结束
type: end
height: 90
id: '1732007423290'
position:
x: 688
y: 282
positionAbsolute:
x: 688
y: 282
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
viewport:
x: 132.5007443566236
y: 97.9169671661925
zoom: 0.5277768588189832
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ A:我一般把所有image,前面的链接加上 dockerpull.com
<img src="./images/Xnip2024-11-19_10-14-02.jpg" alt="示例图片" width="400">
</details>


<details>
<summary>sandbox 如何安装pandas这些第三方库?</summary>
A:打开 /docker/volumes/sandbox/dependencies/python-requirements.txt 填入需要安装的依赖,重启sandbox即可。
</details>

<details>
<summary>拿到图片URL后能在聊天窗口显示吗,试了下markdown但什么都没显示出来。</summary>
<img src="./images/image001.png" alt="示例图片" width="400">
Expand Down Expand Up @@ -68,6 +74,12 @@ A:执行下面的指令:docker exec -it docker-api-1 flask reset-password

你可以参考下面每个 yml 的描述,找到你需要的 Workflow,然后在 DSL 文件夹中找到对应的文件,复制文件的 URL,导入自己的 Dify 账号即可。

## 2024-11-20更新

| 文件 | 描述 | 来源 |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |
| `json-repair.yml` | 大模型输出的JSON格式不标准,少个引号,多个括号,通过这个流程修复为可解析的的JSON ![](./snapshots/Xnip2024-11-20_09-45-48.jpg) | 微信 @svcvit |

## 2024-11-15更新

| 文件 | 描述 | 来源 |
Expand Down
Binary file added snapshots/Xnip2024-11-20_09-45-48.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 13fc533

Please sign in to comment.