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
c4ee9581
authored
Jul 14, 2024
by
hhhero
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[代码优化]AI: 目录更名writer => write,写作管理调整
parent
0a48b523
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
29 additions
and
216 deletions
+29
-216
src/api/ai/write/index.ts
+1
-3
src/views/ai/write/index/components/Left.vue
+1
-1
src/views/ai/write/index/components/Right.vue
+0
-0
src/views/ai/write/index/components/Tag.vue
+0
-0
src/views/ai/write/index/index.vue
+2
-2
src/views/ai/write/manager/index.vue
+25
-7
src/views/ai/writer/manager/index.vue
+0
-203
No files found.
src/api/ai/write
r
/index.ts
→
src/api/ai/write/index.ts
View file @
c4ee9581
...
...
@@ -45,7 +45,7 @@ export interface AiWriteRespVo {
createTime
:
string
}
const
WriteApi
=
{
export
const
WriteApi
=
{
writeStream
:
({
data
,
onClose
,
...
...
@@ -83,5 +83,3 @@ const WriteApi = {
return
request
.
delete
({
url
:
`/ai/write/delete`
,
params
:
{
id
}
})
}
}
export
default
WriteApi
src/views/ai/write
r
/index/components/Left.vue
→
src/views/ai/write/index/components/Left.vue
View file @
c4ee9581
...
...
@@ -104,7 +104,7 @@
import
{
createReusableTemplate
}
from
'@vueuse/core'
import
{
ref
}
from
'vue'
import
Tag
from
'./Tag.vue'
import
{
WriteVO
}
from
'
@/api/ai/writer
'
import
{
WriteVO
}
from
'
src/api/ai/write
'
import
{
omit
}
from
'lodash-es'
import
{
DICT_TYPE
,
getIntDictOptions
}
from
'@/utils/dict'
import
{
AiWriteTypeEnum
,
WriteExample
}
from
'@/views/ai/utils/constants'
...
...
src/views/ai/write
r
/index/components/Right.vue
→
src/views/ai/write/index/components/Right.vue
View file @
c4ee9581
File moved
src/views/ai/write
r
/index/components/Tag.vue
→
src/views/ai/write/index/components/Tag.vue
View file @
c4ee9581
File moved
src/views/ai/write
r
/index/index.vue
→
src/views/ai/write/index/index.vue
View file @
c4ee9581
...
...
@@ -20,7 +20,7 @@
<
script
setup
lang=
"ts"
>
import
Left
from
'./components/Left.vue'
import
Right
from
'./components/Right.vue'
import
WriteApi
from
'@/api/ai/writer
'
import
{
WriteApi
}
from
'@/api/ai/write
'
import
{
WriteExample
}
from
'@/views/ai/utils/constants'
const
message
=
useMessage
()
...
...
@@ -65,7 +65,7 @@ const submit = (data) => {
}
/** 点击示例触发 */
const
handleExampleClick
=
(
type
:
keyof
typeof
WriteExample
DataJson
)
=>
{
const
handleExampleClick
=
(
type
:
keyof
typeof
WriteExample
)
=>
{
writeResult
.
value
=
WriteExample
[
type
].
data
}
...
...
src/views/ai/write/manager/index.vue
View file @
c4ee9581
...
...
@@ -39,7 +39,7 @@
</el-select>
</el-form-item>
<el-form-item
label=
"平台"
prop=
"platform"
>
<el-select
v-model=
"queryParams.
status
"
placeholder=
"请选择平台"
clearable
class=
"!w-240px"
>
<el-select
v-model=
"queryParams.
platform
"
placeholder=
"请选择平台"
clearable
class=
"!w-240px"
>
<el-option
v-for=
"dict in getStrDictOptions(DICT_TYPE.AI_PLATFORM)"
:key=
"dict.value"
...
...
@@ -70,6 +70,7 @@
>
<Icon
icon=
"ep:plus"
class=
"mr-5px"
/>
新增
</el-button>
<!-- TODO @YunaiV 目前没有导出接口,需要导出吗 -->
<el-button
type=
"success"
plain
...
...
@@ -103,7 +104,13 @@
</
template
>
</el-table-column>
<el-table-column
label=
"模型"
align=
"center"
prop=
"model"
width=
"180"
/>
<el-table-column
label=
"生成内容提示"
align=
"center"
prop=
"prompt"
width=
"180"
/>
<el-table-column
label=
"生成内容提示"
align=
"center"
prop=
"prompt"
width=
"180"
show-overflow-tooltip
/>
<el-table-column
label=
"生成的内容"
align=
"center"
prop=
"generatedContent"
width=
"180"
/>
<el-table-column
label=
"原文"
align=
"center"
prop=
"originalContent"
width=
"180"
/>
<el-table-column
label=
"长度"
align=
"center"
prop=
"length"
>
...
...
@@ -136,6 +143,7 @@
<el-table-column
label=
"错误信息"
align=
"center"
prop=
"errorMessage"
/>
<el-table-column
label=
"操作"
align=
"center"
>
<
template
#
default=
"scope"
>
<!-- TODO @YunaiV 目前没有修改接口,写作要可以更改吗-->
<el-button
link
type=
"primary"
...
...
@@ -168,8 +176,8 @@
<
script
setup
lang=
"ts"
>
import
{
DICT_TYPE
,
getIntDictOptions
,
getStrDictOptions
}
from
'@/utils/dict'
import
{
dateFormatter
}
from
'@/utils/formatTime'
// TODO 芋艿:这里应该是 write
import
{
WriteApi
,
WriteVO
}
from
'@/api/ai/writer
'
import
{
useRouter
}
from
'vue-router'
import
{
WriteApi
,
AiWritePageReqVO
,
AiWriteRespVo
}
from
'@/api/ai/write
'
import
*
as
UserApi
from
'@/api/system/user'
/** AI 写作列表 */
...
...
@@ -177,17 +185,18 @@ defineOptions({ name: 'AiWriteManager' })
const
message
=
useMessage
()
// 消息弹窗
const
{
t
}
=
useI18n
()
// 国际化
const
router
=
useRouter
()
// 路由
const
loading
=
ref
(
true
)
// 列表的加载中
const
list
=
ref
<
WriteVO
[]
>
([])
// 列表的数据
const
list
=
ref
<
AiWriteRespVo
[]
>
([])
// 列表的数据
const
total
=
ref
(
0
)
// 列表的总页数
const
queryParams
=
reactive
({
const
queryParams
=
reactive
<
AiWritePageReqVO
>
({
pageNo
:
1
,
pageSize
:
10
,
userId
:
undefined
,
type
:
undefined
,
platform
:
undefined
,
createTime
:
[]
createTime
:
undefined
})
const
queryFormRef
=
ref
()
// 搜索的表单
const
userList
=
ref
<
UserApi
.
UserVO
[]
>
([])
// 用户列表
...
...
@@ -216,6 +225,15 @@ const resetQuery = () => {
handleQuery
()
}
/** 新增方法,跳转到写作页面 **/
const
openForm
=
(
type
:
string
,
id
?:
number
)
=>
{
switch
(
type
)
{
case
'create'
:
router
.
push
(
'/ai/write'
)
break
}
}
/** 删除按钮操作 */
const
handleDelete
=
async
(
id
:
number
)
=>
{
try
{
...
...
src/views/ai/writer/manager/index.vue
deleted
100644 → 0
View file @
0a48b523
<
template
>
<ContentWrap>
<!-- 搜索工作栏 -->
<el-form
class=
"-mb-15px"
:model=
"queryParams"
ref=
"queryFormRef"
:inline=
"true"
label-width=
"68px"
>
<el-form-item
label=
"用户编号"
prop=
"userId"
>
<el-select
v-model=
"queryParams.userId"
clearable
placeholder=
"请输入用户编号"
class=
"!w-240px"
>
<el-option
v-for=
"item in userList"
:key=
"item.id"
:label=
"item.nickname"
:value=
"item.id"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"平台"
prop=
"platform"
>
<el-select
v-model=
"queryParams.platform"
placeholder=
"请选择平台"
clearable
class=
"!w-240px"
>
<el-option
v-for=
"dict in getStrDictOptions(DICT_TYPE.AI_PLATFORM)"
:key=
"dict.value"
:label=
"dict.label"
:value=
"dict.value"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"是否发布"
prop=
"publicStatus"
>
<el-select
v-model=
"queryParams.type"
placeholder=
"请选择写作方式"
clearable
class=
"!w-240px"
>
<el-option
label=
"撰写"
:value=
"AiWriteTypeEnum.WRITING"
/>
<el-option
label=
"回复"
:value=
"AiWriteTypeEnum.REPLY"
/>
</el-select>
</el-form-item>
<el-form-item
label=
"创建时间"
prop=
"createTime"
>
<el-date-picker
v-model=
"queryParams.createTime"
value-format=
"YYYY-MM-DD HH:mm:ss"
type=
"daterange"
start-placeholder=
"开始日期"
end-placeholder=
"结束日期"
:default-time=
"[new Date('1 00:00:00'), new Date('1 23:59:59')]"
class=
"!w-220px"
/>
</el-form-item>
<el-form-item>
<el-button
@
click=
"handleQuery"
><Icon
icon=
"ep:search"
class=
"mr-5px"
/>
搜索
</el-button>
<el-button
@
click=
"resetQuery"
><Icon
icon=
"ep:refresh"
class=
"mr-5px"
/>
重置
</el-button>
</el-form-item>
</el-form>
</ContentWrap>
<!-- 列表 -->
<ContentWrap>
<el-table
v-loading=
"loading"
:data=
"list"
:stripe=
"true"
:show-overflow-tooltip=
"true"
>
<el-table-column
label=
"编号"
align=
"center"
prop=
"id"
width=
"180"
fixed=
"left"
/>
<el-table-column
label=
"用户"
align=
"center"
prop=
"userId"
width=
"180"
>
<template
#
default=
"scope"
>
<span>
{{
userList
.
find
((
item
)
=>
item
.
id
===
scope
.
row
.
userId
)?.
nickname
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"写作类型"
align=
"center"
prop=
"platform"
width=
"120"
>
<
template
#
default=
"scope"
>
{{
AiWriteTypeTableRender
[
scope
.
row
.
type
]
}}
</
template
>
</el-table-column>
<el-table-column
label=
"平台"
align=
"center"
prop=
"platform"
width=
"120"
>
<
template
#
default=
"scope"
>
<dict-tag
:type=
"DICT_TYPE.AI_PLATFORM"
:value=
"scope.row.platform"
/>
</
template
>
</el-table-column>
<el-table-column
label=
"模型"
align=
"center"
prop=
"model"
width=
"180"
/>
<el-table-column
label=
"预览内容"
align=
"center"
prop=
"generatedContent"
width=
"200"
show-overflow-tooltip
/>
<el-table-column
label=
"提示词"
align=
"center"
prop=
"prompt"
width=
"180"
/>
<el-table-column
label=
"原文"
align=
"center"
prop=
"originalContent"
width=
"180"
/>
<el-table-column
label=
"长度"
align=
"center"
prop=
"length"
width=
"180"
/>
<el-table-column
label=
"格式"
align=
"center"
prop=
"format"
width=
"180"
/>
<el-table-column
label=
"语气"
align=
"center"
prop=
"tone"
width=
"180"
/>
<el-table-column
label=
"语言"
align=
"center"
prop=
"language"
width=
"180"
/>
<el-table-column
label=
"创建时间"
align=
"center"
prop=
"createTime"
:formatter=
"dateFormatter"
width=
"180px"
/>
<el-table-column
label=
"错误信息"
align=
"center"
prop=
"errorMessage"
/>
<el-table-column
label=
"操作"
align=
"center"
width=
"100"
fixed=
"right"
>
<
template
#
default=
"scope"
>
<el-button
link
type=
"danger"
@
click=
"handleDelete(scope.row.id)"
v-hasPermi=
"['ai:write:delete']"
>
删除
</el-button>
</
template
>
</el-table-column>
</el-table>
<!-- 分页 -->
<Pagination
:total=
"total"
v-model:page=
"queryParams.pageNo"
v-model:limit=
"queryParams.pageSize"
@
pagination=
"getList"
/>
</ContentWrap>
</template>
<
script
setup
lang=
"ts"
>
import
{
DICT_TYPE
,
getStrDictOptions
}
from
'@/utils/dict'
import
{
dateFormatter
}
from
'@/utils/formatTime'
import
WriteApi
,
{
AiWritePageReqVO
,
AiWriteRespVo
}
from
'@/api/ai/writer'
import
*
as
UserApi
from
'@/api/system/user'
import
{
AiWriteTypeEnum
,
AiWriteTypeTableRender
}
from
'@/views/ai/utils/constants'
/** AI 写作 列表 */
defineOptions
({
name
:
'AiWriteManage'
})
const
message
=
useMessage
()
// 消息弹窗
const
{
t
}
=
useI18n
()
// 国际化
const
loading
=
ref
(
true
)
// 列表的加载中
const
list
=
ref
<
AiWriteRespVo
[]
>
([])
// 列表的数据
const
total
=
ref
(
0
)
// 列表的总页数
const
queryParams
=
reactive
<
AiWritePageReqVO
>
({
pageNo
:
1
,
pageSize
:
10
,
userId
:
undefined
,
platform
:
undefined
,
createTime
:
undefined
})
const
queryFormRef
=
ref
()
// 搜索的表单
const
userList
=
ref
<
UserApi
.
UserVO
[]
>
([])
// 用户列表
/** 查询列表 */
const
getList
=
async
()
=>
{
loading
.
value
=
true
try
{
const
data
=
await
WriteApi
.
getWritePage
(
queryParams
)
list
.
value
=
data
.
list
total
.
value
=
data
.
total
}
finally
{
loading
.
value
=
false
}
}
/** 搜索按钮操作 */
const
handleQuery
=
()
=>
{
queryParams
.
pageNo
=
1
getList
()
}
/** 重置按钮操作 */
const
resetQuery
=
()
=>
{
queryFormRef
.
value
.
resetFields
()
handleQuery
()
}
/** 删除按钮操作 */
const
handleDelete
=
async
(
id
:
number
)
=>
{
try
{
// 删除的二次确认
await
message
.
delConfirm
()
// 发起删除
await
WriteApi
.
deleteWrite
(
id
)
message
.
success
(
t
(
'common.delSuccess'
))
// 刷新列表
await
getList
()
}
catch
{}
}
/** 初始化 **/
onMounted
(
async
()
=>
{
getList
()
// 获得用户列表
userList
.
value
=
await
UserApi
.
getSimpleUserList
()
})
</
script
>
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