Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
J
jinchat-server
概览
概览
详情
活动
周期分析
版本库
存储库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
aigc-pioneer
jinchat-server
Commits
fc9d9f3c
提交
fc9d9f3c
authored
5月 13, 2023
作者:
fxjhello
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
vue页面完成90%
上级
839911a3
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
40 行增加
和
11 行删除
+40
-11
chat.ts
views/src/api/chat.ts
+2
-3
id.ts
views/src/store/modules/knowledgebaseid/id.ts
+11
-0
index.vue
views/src/views/chat/index.vue
+14
-5
filelist.vue
...s/src/views/chat/layout/sider/knowledge-base/filelist.vue
+1
-1
index.vue
views/src/views/chat/layout/sider/knowledge-base/index.vue
+11
-0
vite.config.ts
views/vite.config.ts
+1
-2
没有找到文件。
views/src/api/chat.ts
浏览文件 @
fc9d9f3c
import
qs
from
'qs'
import
{
api
}
from
'./api'
import
{
api
}
from
'./api'
export
const
chat
=
(
params
:
any
)
=>
{
export
const
chat
=
(
params
:
any
)
=>
{
...
@@ -11,9 +10,9 @@ export const chat = (params: any) => {
...
@@ -11,9 +10,9 @@ export const chat = (params: any) => {
export
const
chatfile
=
(
params
:
any
)
=>
{
export
const
chatfile
=
(
params
:
any
)
=>
{
return
api
({
return
api
({
url
:
'/
chatfile
'
,
url
:
'/
local_doc_qa/local_doc_chat
'
,
method
:
'post'
,
method
:
'post'
,
data
:
qs
.
stringify
(
params
),
data
:
JSON
.
stringify
(
params
),
})
})
}
}
...
...
views/src/store/modules/knowledgebaseid/id.ts
0 → 100644
浏览文件 @
fc9d9f3c
import
{
defineStore
}
from
'pinia'
export
const
idStore
=
defineStore
(
'idStore'
,
{
state
:
()
=>
{
return
{
knowledgeid
:
'samples'
,
}
},
})
views/src/views/chat/index.vue
浏览文件 @
fc9d9f3c
...
@@ -15,6 +15,7 @@ import { useBasicLayout } from '@/hooks/useBasicLayout'
...
@@ -15,6 +15,7 @@ import { useBasicLayout } from '@/hooks/useBasicLayout'
import
{
useChatStore
,
usePromptStore
}
from
'@/store'
import
{
useChatStore
,
usePromptStore
}
from
'@/store'
import
{
t
}
from
'@/locales'
import
{
t
}
from
'@/locales'
import
{
chat
,
chatfile
}
from
'@/api/chat'
import
{
chat
,
chatfile
}
from
'@/api/chat'
import
{
idStore
}
from
'@/store/modules/knowledgebaseid/id'
let
controller
=
new
AbortController
()
let
controller
=
new
AbortController
()
// const openLongReply = import.meta.env.VITE_GLOB_OPEN_LONG_REPLY === 'true'
// const openLongReply = import.meta.env.VITE_GLOB_OPEN_LONG_REPLY === 'true'
...
@@ -22,7 +23,7 @@ let controller = new AbortController()
...
@@ -22,7 +23,7 @@ let controller = new AbortController()
const
route
=
useRoute
()
const
route
=
useRoute
()
const
dialog
=
useDialog
()
const
dialog
=
useDialog
()
const
ms
=
useMessage
()
const
ms
=
useMessage
()
const
idstore
=
idStore
()
const
chatStore
=
useChatStore
()
const
chatStore
=
useChatStore
()
const
history
=
ref
<
any
>
([])
const
history
=
ref
<
any
>
([])
const
{
isMobile
}
=
useBasicLayout
()
const
{
isMobile
}
=
useBasicLayout
()
...
@@ -60,9 +61,12 @@ function handleSubmit() {
...
@@ -60,9 +61,12 @@ function handleSubmit() {
async
function
onConversation
()
{
async
function
onConversation
()
{
const
message
=
prompt
.
value
const
message
=
prompt
.
value
dataSources
.
value
.
forEach
((
item
)
=>
{
if
(
usingContext
.
value
)
{
console
.
log
(
item
)
for
(
let
i
=
0
;
i
<
dataSources
.
value
.
length
;
i
=
i
+
2
)
})
history
.
value
.
push
([
dataSources
.
value
[
i
].
text
,
dataSources
.
value
[
i
+
1
].
text
])
}
else
{
history
.
value
.
length
=
0
}
if
(
loading
.
value
)
if
(
loading
.
value
)
return
return
...
@@ -112,6 +116,7 @@ async function onConversation() {
...
@@ -112,6 +116,7 @@ async function onConversation() {
const
fetchChatAPIOnce
=
async
()
=>
{
const
fetchChatAPIOnce
=
async
()
=>
{
const
res
=
active
.
value
const
res
=
active
.
value
?
await
chatfile
({
?
await
chatfile
({
knowledge_base_id
:
idstore
.
knowledgeid
,
question
:
message
,
question
:
message
,
history
:
history
.
value
,
history
:
history
.
value
,
})
})
...
@@ -266,7 +271,11 @@ async function onRegenerate(index: number) {
...
@@ -266,7 +271,11 @@ async function onRegenerate(index: number) {
const
lastText
=
''
const
lastText
=
''
const
fetchChatAPIOnce
=
async
()
=>
{
const
fetchChatAPIOnce
=
async
()
=>
{
const
res
=
active
.
value
const
res
=
active
.
value
?
await
chatfile
({
message
})
?
await
chatfile
({
knowledge_base_id
:
idstore
.
knowledgeid
,
question
:
message
,
history
:
history
.
value
,
})
:
await
chat
({
:
await
chat
({
question
:
message
,
question
:
message
,
history
:
history
.
value
,
history
:
history
.
value
,
...
...
views/src/views/chat/layout/sider/knowledge-base/filelist.vue
浏览文件 @
fc9d9f3c
...
@@ -41,7 +41,7 @@ function handleEnter({ uuid }: Chat.History, isEdit: boolean, event: KeyboardEve
...
@@ -41,7 +41,7 @@ function handleEnter({ uuid }: Chat.History, isEdit: boolean, event: KeyboardEve
<NUpload
<NUpload
multiple
multiple
directory-dnd
directory-dnd
action=
"http://1
92.168.1.128
:1002/api/local_doc_qa/upload_file"
action=
"http://1
27.0.0.1
:1002/api/local_doc_qa/upload_file"
:headers=
"
{
:headers=
"
{
'naive-info': 'hello!',
'naive-info': 'hello!',
}"
}"
...
...
views/src/views/chat/layout/sider/knowledge-base/index.vue
浏览文件 @
fc9d9f3c
...
@@ -3,8 +3,13 @@ import { NButton, NForm, NFormItem, NInput } from 'naive-ui'
...
@@ -3,8 +3,13 @@ import { NButton, NForm, NFormItem, NInput } from 'naive-ui'
import
{
onMounted
,
ref
}
from
'vue'
import
{
onMounted
,
ref
}
from
'vue'
import
filelist
from
'./filelist.vue'
import
filelist
from
'./filelist.vue'
import
{
getfilelist
}
from
'@/api/chat'
import
{
getfilelist
}
from
'@/api/chat'
import
{
idStore
}
from
'@/store/modules/knowledgebaseid/id'
const
items
=
ref
<
any
>
([])
const
items
=
ref
<
any
>
([])
const
choice
=
ref
(
''
)
const
store
=
idStore
()
onMounted
(
async
()
=>
{
onMounted
(
async
()
=>
{
choice
.
value
=
store
.
knowledgeid
const
res
=
await
getfilelist
({})
const
res
=
await
getfilelist
({})
res
.
data
.
data
.
forEach
((
item
:
any
)
=>
{
res
.
data
.
data
.
forEach
((
item
:
any
)
=>
{
items
.
value
.
push
({
items
.
value
.
push
({
...
@@ -28,6 +33,9 @@ const rules = {
...
@@ -28,6 +33,9 @@ const rules = {
},
},
}
}
const
handleValidateClick
=
(
item
:
any
)
=>
{
const
handleValidateClick
=
(
item
:
any
)
=>
{
// console.log(item)
choice
.
value
=
item
store
.
knowledgeid
=
choice
.
value
items
.
value
.
forEach
((
res
:
{
value
:
any
;
show
:
boolean
})
=>
{
items
.
value
.
forEach
((
res
:
{
value
:
any
;
show
:
boolean
})
=>
{
if
(
res
.
value
===
item
)
if
(
res
.
value
===
item
)
res
.
show
=
!
res
.
show
res
.
show
=
!
res
.
show
...
@@ -46,6 +54,9 @@ const handleClick = () => {
...
@@ -46,6 +54,9 @@ const handleClick = () => {
</
script
>
</
script
>
<
template
>
<
template
>
<NButton
block
size=
"large"
>
对话知识库:
{{
choice
}}
</NButton>
<NForm
<NForm
ref=
"formRef"
ref=
"formRef"
inline
inline
...
...
views/vite.config.ts
浏览文件 @
fc9d9f3c
...
@@ -37,8 +37,7 @@ export default defineConfig((env) => {
...
@@ -37,8 +37,7 @@ export default defineConfig((env) => {
open
:
false
,
open
:
false
,
proxy
:
{
proxy
:
{
'/api'
:
{
'/api'
:
{
target
:
'http://146.56.190.29'
,
target
:
'http://127.0.0.1:7861'
,
// target: 'http://127.0.0.1:7861',
changeOrigin
:
true
,
// 允许跨域
changeOrigin
:
true
,
// 允许跨域
rewrite
:
path
=>
path
.
replace
(
'/api/'
,
''
),
rewrite
:
path
=>
path
.
replace
(
'/api/'
,
''
),
},
},
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论