个性化记忆助手
暂无描述
工作流图谱
YAML 源码
app:
description: ''
icon: 📝
icon_background: '#FFEAD5'
mode: advanced-chat
name: 个性化记忆助手
use_icon_as_answer_icon: false
dependencies:
- current_identifier: null
type: marketplace
value:
marketplace_plugin_unique_identifier: langgenius/openai:0.0.13@9caa0421b5519db036aaccdbf1980d1071550767d6c59e9d9388dd386a92e9f6
kind: app
version: 0.1.5
workflow:
conversation_variables:
- description: ''
id: bacbfac5-a1da-420e-a022-7f90d554da80
name: memory
selector:
- conversation
- memory
value: []
value_type: array[object]
environment_variables: []
features:
file_upload:
allowed_file_extensions:
- .JPG
- .JPEG
- .PNG
- .GIF
- .WEBP
- .SVG
allowed_file_types:
- image
allowed_file_upload_methods:
- local_file
- remote_url
enabled: false
fileUploadConfig:
audio_file_size_limit: 50
batch_count_limit: 5
file_size_limit: 15
image_file_size_limit: 10
video_file_size_limit: 100
workflow_file_upload_limit: 10
image:
enabled: false
number_limits: 3
transfer_methods:
- local_file
- remote_url
number_limits: 3
opening_statement: ''
retriever_resource:
enabled: false
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: llm
id: 1723433389887-source-1723439627061-target
selected: false
source: '1723433389887'
sourceHandle: source
target: '1723439627061'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: if-else
id: 1723439627061-source-1723440384014-target
selected: false
source: '1723439627061'
sourceHandle: source
target: '1723440384014'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: if-else
targetType: llm
id: 1723440384014-true-1723440416057-target
selected: false
source: '1723440384014'
sourceHandle: 'true'
target: '1723440416057'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: code
id: 1723440416057-source-1723441002334-target
selected: false
source: '1723440416057'
sourceHandle: source
target: '1723441002334'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: code
targetType: assigner
id: 1723441002334-source-1723440950024-target
selected: false
source: '1723441002334'
sourceHandle: source
target: '1723440950024'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: answer
id: 1723442720119-source-answer-target
selected: false
source: '1723442720119'
sourceHandle: source
target: answer
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: llm
targetType: answer
id: 17234428530880-source-17234428657830-target
selected: false
source: '17234428530880'
sourceHandle: source
target: '17234428657830'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: if-else
targetType: code
id: 1723440384014-false-1723443740666-target
selected: false
source: '1723440384014'
sourceHandle: 'false'
target: '1723443740666'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: code
targetType: llm
id: 1723443740666-source-17234428530880-target
selected: false
source: '1723443740666'
sourceHandle: source
target: '17234428530880'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: assigner
targetType: code
id: 1723440950024-source-1723444029520-target
selected: false
source: '1723440950024'
sourceHandle: source
target: '1723444029520'
targetHandle: target
type: custom
zIndex: 0
- data:
isInIteration: false
sourceType: code
targetType: llm
id: 1723444029520-source-1723442720119-target
selected: false
source: '1723444029520'
sourceHandle: source
target: '1723442720119'
targetHandle: target
type: custom
zIndex: 0
nodes:
- data:
desc: ''
selected: false
title: 开始
type: start
variables: []
height: 54
id: '1723433389887'
position:
x: 30
y: 266
positionAbsolute:
x: 30
y: 266
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
answer: '{{#1723442720119.text#}}'
desc: ''
selected: false
title: Answer(2)
type: answer
variables: []
height: 105
id: answer
position:
x: 2462
y: 266
positionAbsolute:
x: 2462
y: 266
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
context:
enabled: false
variable_selector: []
desc: ''
model:
completion_params:
temperature: 0.7
mode: chat
name: gpt-4o
provider: langgenius/openai/openai
prompt_template:
- id: 4447a6dc-5818-47ff-9b4d-a64792e4e8dc
role: system
text: "确定 {{#sys.query#}} 中是否有需要存储为记忆的信息。\n记忆的定义:从提供的文本中推断出事实、偏好和记忆。推断事实、偏好和记忆的约束:\
\ \n- 事实、偏好和记忆应该简洁且信息丰富。 \n- 不要以“这个人喜欢披萨”开头。而是以“喜欢披萨”开头。 \n- 不要记住提供的用户/代理详细信息。只记住事实、偏好和记忆。\n\
输出:\n用一个词输出 Yes 或 No"
selected: false
title: 判断 query 是否存在需要记忆的部分
type: llm
variables: []
vision:
configs:
detail: high
enabled: true
height: 96
id: '1723439627061'
position:
x: 334
y: 266
positionAbsolute:
x: 334
y: 266
selected: true
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
cases:
- case_id: 'true'
conditions:
- comparison_operator: contains
id: ce01e29b-8afa-42c9-9cd0-16aa9c3dc06e
value: 'Yes'
varType: string
variable_selector:
- '1723439627061'
- text
id: 'true'
logical_operator: and
desc: ''
selected: false
title: 条件分支
type: if-else
height: 126
id: '1723440384014'
position:
x: 638
y: 266
positionAbsolute:
x: 638
y: 266
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
context:
enabled: false
variable_selector: []
desc: ''
model:
completion_params:
temperature: 0.7
mode: chat
name: gpt-4o
provider: langgenius/openai/openai
prompt_template:
- id: c99691e0-c192-4f14-8caa-3ea897c01bea
role: system
text: '"""
从 {{#sys.query#}} 推断事实、偏好和记忆
只需以项目符号形式返回事实、偏好和记忆:
自然语言文本:{user_input}
用户/代理详细信息:{metadata}
推断事实、偏好和记忆的约束:
- 事实、偏好和记忆应简洁明了。
- 不要以“此人喜欢披萨”开头。相反,以“喜欢披萨”开头。
- 不要记住提供的用户/代理详细信息。只记住事实、偏好和记忆。
推断的事实、偏好和记忆:
输出格式示例:
{
"memory": {
"facts": [
"两个人:Ray 和 Lily",
"Ray 20 岁",
"Lily 18 岁",
"Lily 的名字包含汉字‘利利’"
],
"preferences": [],
"memories": []
}
}
"""'
selected: false
title: 提取记忆
type: llm
variables: []
vision:
configs:
detail: high
enabled: true
height: 96
id: '1723440416057'
position:
x: 942
y: 266
positionAbsolute:
x: 942
y: 266
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
assigned_variable_selector:
- conversation
- memory
desc: ''
input_variable_selector:
- '1723441002334'
- mem
selected: false
title: 将提取的记忆写入会话变量
type: assigner
write_mode: append
height: 88
id: '1723440950024'
position:
x: 1550
y: 266
positionAbsolute:
x: 1550
y: 266
selected: false
sourcePosition: right
targetPosition: left
type: custom
width: 244
- data:
code: "import json\n\ndef main(arg1: str) -> object:\n try:\n #\
\ Parse the input JSON string\n input_data = json.loads(arg1)\n \
\ \n # Extract the memory object\n memory = input_data.get(\"\
memory\", {})\n \n # Construct the return object\n \
\ result = {\n \"facts\": memory.get(\"facts\", []),\n \
...(过长已截断)