Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jinchat-server
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
aigc-pioneer
jinchat-server
Commits
3fbbf1d7
提交
3fbbf1d7
authored
4月 12, 2023
作者:
imClumsyPanda
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update README.md
上级
26f398f3
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
49 行增加
和
24 行删除
+49
-24
webui.py
webui.py
+49
-24
没有找到文件。
webui.py
浏览文件 @
3fbbf1d7
...
@@ -70,16 +70,26 @@ with gr.Blocks(css="""
...
@@ -70,16 +70,26 @@ with gr.Blocks(css="""
show_label
=
False
)
.
style
(
height
=
600
)
show_label
=
False
)
.
style
(
height
=
600
)
with
gr
.
Column
(
scale
=
1
):
with
gr
.
Column
(
scale
=
1
):
with
gr
.
Column
():
with
gr
.
Column
():
llm_model
=
gr
.
Radio
(
llm_model
=
gr
.
Radio
(
llm_model_dict_list
,
llm_model_dict_list
,
label
=
"llm model"
,
label
=
"llm model"
,
value
=
"chatglm-6b"
,
interactive
=
True
)
value
=
"chatglm-6b"
,
LLM_HISTORY_LEN
=
gr
.
Slider
(
interactive
=
True
)
1
,
10
,
value
=
3
,
step
=
1
,
label
=
"LLM history len"
,
interactive
=
True
)
LLM_HISTORY_LEN
=
gr
.
Slider
(
1
,
embedding_model
=
gr
.
Radio
(
10
,
embedding_model_dict_list
,
label
=
"embedding model"
,
value
=
3
,
value
=
"text2vec"
,
interactive
=
True
)
step
=
1
,
VECTOR_SEARCH_TOP_K
=
gr
.
Slider
(
label
=
"LLM history len"
,
1
,
20
,
value
=
6
,
step
=
1
,
label
=
"vector search top k"
,
interactive
=
True
)
interactive
=
True
)
embedding_model
=
gr
.
Radio
(
embedding_model_dict_list
,
label
=
"embedding model"
,
value
=
"text2vec"
,
interactive
=
True
)
VECTOR_SEARCH_TOP_K
=
gr
.
Slider
(
1
,
20
,
value
=
6
,
step
=
1
,
label
=
"vector search top k"
,
interactive
=
True
)
load_model_button
=
gr
.
Button
(
"step.1:setting"
)
load_model_button
=
gr
.
Button
(
"step.1:setting"
)
load_model_button
.
click
(
lambda
*
args
:
load_model_button
.
click
(
lambda
*
args
:
kb
.
init_cfg
(
args
[
0
],
args
[
1
],
args
[
2
],
args
[
3
]),
kb
.
init_cfg
(
args
[
0
],
args
[
1
],
args
[
2
],
args
[
3
]),
...
@@ -92,14 +102,18 @@ with gr.Blocks(css="""
...
@@ -92,14 +102,18 @@ with gr.Blocks(css="""
with
gr
.
Column
():
with
gr
.
Column
():
with
gr
.
Tab
(
"select"
):
with
gr
.
Tab
(
"select"
):
selectFile
=
gr
.
Dropdown
(
selectFile
=
gr
.
Dropdown
(
file_list
,
file_list
,
label
=
"content file"
,
interactive
=
True
,
label
=
"content file"
,
value
=
file_list
[
0
]
if
len
(
file_list
)
>
0
else
None
)
interactive
=
True
,
value
=
file_list
[
0
]
if
len
(
file_list
)
>
0
else
None
)
with
gr
.
Tab
(
"upload"
):
with
gr
.
Tab
(
"upload"
):
file
=
gr
.
File
(
label
=
"content file"
,
file_types
=
[
file
=
gr
.
File
(
label
=
"content file"
,
'.txt'
,
'.md'
,
'.docx'
])
.
style
(
height
=
100
)
file_types
=
[
'.txt'
,
'.md'
,
'.docx'
]
)
.
style
(
height
=
100
)
# 将上传的文件保存到content文件夹下,并更新下拉框
# 将上传的文件保存到content文件夹下,并更新下拉框
file
.
upload
(
upload_file
,
inputs
=
file
,
outputs
=
selectFile
)
file
.
upload
(
upload_file
,
inputs
=
file
,
outputs
=
selectFile
)
history
=
gr
.
State
([])
history
=
gr
.
State
([])
vector_store
=
gr
.
State
()
vector_store
=
gr
.
State
()
load_button
=
gr
.
Button
(
"step.2:loading"
)
load_button
=
gr
.
Button
(
"step.2:loading"
)
...
@@ -108,19 +122,30 @@ with gr.Blocks(css="""
...
@@ -108,19 +122,30 @@ with gr.Blocks(css="""
"content/"
+
fileName
),
"content/"
+
fileName
),
show_progress
=
True
,
show_progress
=
True
,
api_name
=
"init_knowledge_vector_store"
,
api_name
=
"init_knowledge_vector_store"
,
inputs
=
selectFile
,
outputs
=
vector_store
)
.
then
(
inputs
=
selectFile
,
get_file_status
,
chatbot
,
chatbot
,
show_progress
=
True
,
outputs
=
vector_store
)
.
then
(
get_file_status
,
chatbot
,
chatbot
,
show_progress
=
True
,
)
)
with
gr
.
Row
():
with
gr
.
Row
():
with
gr
.
Column
(
scale
=
2
):
with
gr
.
Column
(
scale
=
2
):
query
=
gr
.
Textbox
(
show_label
=
False
,
placeholder
=
"Prompts"
,
lines
=
1
,
value
=
"用200字总结一下"
)
.
style
(
query
=
gr
.
Textbox
(
show_label
=
False
,
container
=
False
)
placeholder
=
"Prompts"
,
lines
=
1
,
value
=
"用200字总结一下"
)
.
style
(
container
=
False
)
with
gr
.
Column
(
scale
=
1
):
with
gr
.
Column
(
scale
=
1
):
generate_button
=
gr
.
Button
(
generate_button
=
gr
.
Button
(
"step.3:asking"
,
"step.3:asking"
,
elem_classes
=
"importantButton"
)
elem_classes
=
"importantButton"
)
generate_button
.
click
(
get_answer
,
[
query
,
vector_store
,
chatbot
],
generate_button
.
click
(
get_answer
,
[
chatbot
,
history
],
api_name
=
"get_knowledge_based_answer"
)
[
query
,
vector_store
,
chatbot
],
[
chatbot
,
history
],
api_name
=
"get_knowledge_based_answer"
)
demo
.
queue
(
concurrency_count
=
3
)
.
launch
(
demo
.
queue
(
concurrency_count
=
3
)
.
launch
(
server_name
=
'0.0.0.0'
,
share
=
False
,
inbrowser
=
False
)
server_name
=
'0.0.0.0'
,
share
=
False
,
inbrowser
=
False
)
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论