Skip to content

Commit c4ee958

Browse files
committed
[代码优化]AI: 目录更名writer => write,写作管理调整
1 parent 0a48b52 commit c4ee958

File tree

7 files changed

+29
-216
lines changed

7 files changed

+29
-216
lines changed

src/api/ai/writer/index.ts renamed to src/api/ai/write/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export interface AiWriteRespVo {
4545
createTime: string
4646
}
4747

48-
const WriteApi = {
48+
export const WriteApi = {
4949
writeStream: ({
5050
data,
5151
onClose,
@@ -83,5 +83,3 @@ const WriteApi = {
8383
return request.delete({ url: `/ai/write/delete`, params: { id } })
8484
}
8585
}
86-
87-
export default WriteApi

src/views/ai/writer/index/components/Left.vue renamed to src/views/ai/write/index/components/Left.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
import { createReusableTemplate } from '@vueuse/core'
105105
import { ref } from 'vue'
106106
import Tag from './Tag.vue'
107-
import { WriteVO } from '@/api/ai/writer'
107+
import { WriteVO } from 'src/api/ai/write'
108108
import { omit } from 'lodash-es'
109109
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
110110
import { AiWriteTypeEnum, WriteExample } from '@/views/ai/utils/constants'

src/views/ai/writer/index/index.vue renamed to src/views/ai/write/index/index.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<script setup lang="ts">
2121
import Left from './components/Left.vue'
2222
import Right from './components/Right.vue'
23-
import WriteApi from '@/api/ai/writer'
23+
import { WriteApi } from '@/api/ai/write'
2424
import { WriteExample } from '@/views/ai/utils/constants'
2525
2626
const message = useMessage()
@@ -65,7 +65,7 @@ const submit = (data) => {
6565
}
6666
6767
/** 点击示例触发 */
68-
const handleExampleClick = (type: keyof typeof WriteExampleDataJson) => {
68+
const handleExampleClick = (type: keyof typeof WriteExample) => {
6969
writeResult.value = WriteExample[type].data
7070
}
7171

src/views/ai/write/manager/index.vue

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
</el-select>
4040
</el-form-item>
4141
<el-form-item label="平台" prop="platform">
42-
<el-select v-model="queryParams.status" placeholder="请选择平台" clearable class="!w-240px">
42+
<el-select v-model="queryParams.platform" placeholder="请选择平台" clearable class="!w-240px">
4343
<el-option
4444
v-for="dict in getStrDictOptions(DICT_TYPE.AI_PLATFORM)"
4545
:key="dict.value"
@@ -70,6 +70,7 @@
7070
>
7171
<Icon icon="ep:plus" class="mr-5px" /> 新增
7272
</el-button>
73+
<!-- TODO @YunaiV 目前没有导出接口,需要导出吗 -->
7374
<el-button
7475
type="success"
7576
plain
@@ -103,7 +104,13 @@
103104
</template>
104105
</el-table-column>
105106
<el-table-column label="模型" align="center" prop="model" width="180" />
106-
<el-table-column label="生成内容提示" align="center" prop="prompt" width="180" />
107+
<el-table-column
108+
label="生成内容提示"
109+
align="center"
110+
prop="prompt"
111+
width="180"
112+
show-overflow-tooltip
113+
/>
107114
<el-table-column label="生成的内容" align="center" prop="generatedContent" width="180" />
108115
<el-table-column label="原文" align="center" prop="originalContent" width="180" />
109116
<el-table-column label="长度" align="center" prop="length">
@@ -136,6 +143,7 @@
136143
<el-table-column label="错误信息" align="center" prop="errorMessage" />
137144
<el-table-column label="操作" align="center">
138145
<template #default="scope">
146+
<!-- TODO @YunaiV 目前没有修改接口,写作要可以更改吗-->
139147
<el-button
140148
link
141149
type="primary"
@@ -168,26 +176,27 @@
168176
<script setup lang="ts">
169177
import { DICT_TYPE, getIntDictOptions, getStrDictOptions } from '@/utils/dict'
170178
import { dateFormatter } from '@/utils/formatTime'
171-
// TODO 芋艿:这里应该是 write
172-
import { WriteApi, WriteVO } from '@/api/ai/writer'
179+
import { useRouter } from 'vue-router'
180+
import { WriteApi, AiWritePageReqVO, AiWriteRespVo } from '@/api/ai/write'
173181
import * as UserApi from '@/api/system/user'
174182
175183
/** AI 写作列表 */
176184
defineOptions({ name: 'AiWriteManager' })
177185
178186
const message = useMessage() // 消息弹窗
179187
const { t } = useI18n() // 国际化
188+
const router = useRouter() // 路由
180189
181190
const loading = ref(true) // 列表的加载中
182-
const list = ref<WriteVO[]>([]) // 列表的数据
191+
const list = ref<AiWriteRespVo[]>([]) // 列表的数据
183192
const total = ref(0) // 列表的总页数
184-
const queryParams = reactive({
193+
const queryParams = reactive<AiWritePageReqVO>({
185194
pageNo: 1,
186195
pageSize: 10,
187196
userId: undefined,
188197
type: undefined,
189198
platform: undefined,
190-
createTime: []
199+
createTime: undefined
191200
})
192201
const queryFormRef = ref() // 搜索的表单
193202
const userList = ref<UserApi.UserVO[]>([]) // 用户列表
@@ -216,6 +225,15 @@ const resetQuery = () => {
216225
handleQuery()
217226
}
218227
228+
/** 新增方法,跳转到写作页面 **/
229+
const openForm = (type: string, id?: number) => {
230+
switch (type) {
231+
case 'create':
232+
router.push('/ai/write')
233+
break
234+
}
235+
}
236+
219237
/** 删除按钮操作 */
220238
const handleDelete = async (id: number) => {
221239
try {

src/views/ai/writer/manager/index.vue

Lines changed: 0 additions & 203 deletions
This file was deleted.

0 commit comments

Comments
 (0)