Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
56c4ed36
authored
Mar 14, 2025
by
YunaiV
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【功能新增】AI:增加 AI 对话,与 tool 的打通
parent
75575be2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
3 deletions
+26
-3
src/api/ai/model/chatRole/index.ts
+2
-1
src/api/ai/model/tool/index.ts
+5
-0
src/views/ai/model/chatRole/ChatRoleForm.vue
+13
-2
src/views/ai/model/chatRole/index.vue
+6
-0
No files found.
src/api/ai/model/chatRole/index.ts
View file @
56c4ed36
...
...
@@ -13,7 +13,8 @@ export interface ChatRoleVO {
welcomeMessage
:
string
// 角色设定
publicStatus
:
boolean
// 是否公开
status
:
number
// 状态
knowledgeIds
?:
number
[]
// 引用的知识库ID列表
knowledgeIds
?:
number
[]
// 引用的知识库 ID 列表
toolIds
?:
number
[]
// 引用的工具 ID 列表
}
// AI 聊天角色 分页请求 vo
...
...
src/api/ai/model/tool/index.ts
View file @
56c4ed36
...
...
@@ -33,5 +33,10 @@ export const ToolApi = {
// 删除工具
deleteTool
:
async
(
id
:
number
)
=>
{
return
await
request
.
delete
({
url
:
`/ai/tool/delete?id=`
+
id
})
},
// 获取工具简单列表
getToolSimpleList
:
async
()
=>
{
return
await
request
.
get
({
url
:
`/ai/tool/simple-list`
})
}
}
src/views/ai/model/chatRole/ChatRoleForm.vue
View file @
56c4ed36
...
...
@@ -42,6 +42,11 @@
/>
</el-select>
</el-form-item>
<el-form-item
label=
"引用工具"
prop=
"toolIds"
>
<el-select
v-model=
"formData.toolIds"
placeholder=
"请选择工具"
clearable
multiple
>
<el-option
v-for=
"item in toolList"
:key=
"item.id"
:label=
"item.name"
:value=
"item.id"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"是否公开"
prop=
"publicStatus"
v-if=
"!isUser"
>
<el-radio-group
v-model=
"formData.publicStatus"
>
<el-radio
...
...
@@ -82,6 +87,7 @@ import { ModelApi, ModelVO } from '@/api/ai/model/model'
import
{
FormRules
}
from
'element-plus'
import
{
AiModelTypeEnum
}
from
'@/views/ai/utils/constants'
import
{
KnowledgeApi
,
KnowledgeVO
}
from
'@/api/ai/knowledge/knowledge'
import
{
ToolApi
,
ToolVO
}
from
'@/api/ai/model/tool'
/** AI 聊天角色 表单 */
defineOptions
({
name
:
'ChatRoleForm'
})
...
...
@@ -104,11 +110,13 @@ const formData = ref({
systemMessage
:
undefined
,
publicStatus
:
true
,
status
:
CommonStatusEnum
.
ENABLE
,
knowledgeIds
:
[]
as
number
[]
knowledgeIds
:
[]
as
number
[],
toolIds
:
[]
as
number
[]
})
const
formRef
=
ref
()
// 表单 Ref
const
models
=
ref
([]
as
ModelVO
[])
// 聊天模型列表
const
knowledgeList
=
ref
([]
as
KnowledgeVO
[])
// 知识库列表
const
toolList
=
ref
([]
as
ToolVO
[])
// 工具列表
/** 是否【我】自己创建,私有角色 */
const
isUser
=
computed
(()
=>
{
...
...
@@ -145,6 +153,8 @@ const open = async (type: string, id?: number, title?: string) => {
models
.
value
=
await
ModelApi
.
getModelSimpleList
(
AiModelTypeEnum
.
CHAT
)
// 获取知识库列表
knowledgeList
.
value
=
await
KnowledgeApi
.
getSimpleKnowledgeList
()
// 获取工具列表
toolList
.
value
=
await
ToolApi
.
getToolSimpleList
()
}
defineExpose
({
open
})
// 提供 open 方法,用于打开弹窗
...
...
@@ -193,7 +203,8 @@ const resetForm = () => {
systemMessage
:
undefined
,
publicStatus
:
true
,
status
:
CommonStatusEnum
.
ENABLE
,
knowledgeIds
:
[]
knowledgeIds
:
[],
toolIds
:
[]
}
formRef
.
value
?.
resetFields
()
}
...
...
src/views/ai/model/chatRole/index.vue
View file @
56c4ed36
...
...
@@ -75,6 +75,12 @@
<span
v-else
>
引用
{{
scope
.
row
.
knowledgeIds
.
length
}}
个
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"工具"
align=
"center"
prop=
"toolIds"
>
<
template
#
default=
"scope"
>
<span
v-if=
"!scope.row.toolIds || scope.row.toolIds.length === 0"
>
-
</span>
<span
v-else
>
引用
{{
scope
.
row
.
toolIds
.
length
}}
个
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"是否公开"
align=
"center"
prop=
"publicStatus"
>
<
template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.INFRA_BOOLEAN_STRING"
:value=
"scope.row.publicStatus"
/>
...
...
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