Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
Radiant
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wuzekai
Radiant
Commits
226656da
Commit
226656da
authored
Nov 27, 2025
by
wuzekai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对话智能体更改为dify
parent
bc5a96cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
13 deletions
+20
-13
quickgen_chat_ui.R
radiant.quickgen/inst/app/tools/analysis/quickgen_chat_ui.R
+20
-13
No files found.
radiant.quickgen/inst/app/tools/analysis/quickgen_chat_ui.R
View file @
226656da
...
...
@@ -44,21 +44,23 @@ output$chat_main_ui <- renderUI({
## ===== 右侧区域=====
output
$
chat_history_area
<-
renderUI
({
field_info_encoded
<-
get_field_info
()
field_info_encoded
<-
get_field_info
()
if
(
is.null
(
field_info_encoded
))
{
return
(
create_no_data_ui
())
return
(
create_no_data_ui
())
}
iframe_src
<-
paste0
(
"http://180.169.131.147:8106/chat/9f51e1707c61027e?field_info="
,
field_info_encoded
dify_url
<-
paste0
(
"http://180.169.131.147:8078/chatbot/tfjTZpJDgjQpBeTl"
,
"?field_info="
,
field_info_encoded
)
tagList
(
div
(
id
=
"chat_box"
,
style
=
"height:700px; overflow-y:auto; border:1px solid #ddd;
border-radius:4px; padding:0; background:#fff; margin-bottom:10px;"
,
tags
$
iframe
(
src
=
iframe_src
,
src
=
dify_url
,
style
=
"width: 100%; height: 100%; border: 0;"
,
frameborder
=
0
,
allow
=
"microphone"
...
...
@@ -100,32 +102,37 @@ output$field_info_display <- renderUI({
# 获取并编码字段信息
get_field_info
<-
function
()
{
# 1. 校验数据集是否存在
if
(
is.null
(
input
$
dataset
)
||
!
exists
(
"r_data"
))
{
return
(
NULL
)
}
# 2. 尝试获取数据集
df
<-
tryCatch
({
get
(
input
$
dataset
,
envir
=
r_data
)
},
error
=
function
(
e
)
NULL
)
# 3. 数据集为空则返回NULL
if
(
is.null
(
df
)
||
!
is.data.frame
(
df
)
||
nrow
(
df
)
==
0
)
{
return
(
NULL
)
}
#
构建带数据集名称的JSON结构
#
4. 构建字段名-类型映射
fields_list
<-
list
()
for
(
col_name
in
names
(
df
))
{
fields_list
[[
col_name
]]
<-
class
(
df
[[
col_name
]])[
1
]
fields_list
[[
col_name
]]
<-
class
(
df
[[
col_name
]])[
1
]
}
# 5. 构建JSON结构
json_struct
<-
list
(
dataset_name
=
input
$
dataset
,
fields
=
fields_list
dataset_name
=
input
$
dataset
,
fields
=
fields_list
)
# 6. JSON序列化+URL编码
URLencode
(
jsonlite
::
toJSON
(
json_struct
,
auto_unbox
=
TRUE
),
reserved
=
TRUE
jsonlite
::
toJSON
(
json_struct
,
auto_unbox
=
TRUE
),
reserved
=
TRUE
)
}
...
...
@@ -139,4 +146,4 @@ create_no_data_ui <- function() {
p
(
i
18
n
$
t
(
"请选择数据集"
),
style
=
"text-align:center; margin-top:50px; color:#888;"
)
)
)
}
\ No newline at end of file
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment