diff --git a/src/api/ai/writer/index.ts b/src/api/ai/writer/index.ts index 4ce4e2d0..01664b3d 100644 --- a/src/api/ai/writer/index.ts +++ b/src/api/ai/writer/index.ts @@ -1,4 +1,3 @@ -import request from '@/config/axios' import { fetchEventSource } from '@microsoft/fetch-event-source' import { getAccessToken } from '@/utils/auth' @@ -34,7 +33,19 @@ export interface WriteParams { */ language: number } -export const writeStream = (data: WriteParams, onMessage, onError, onClose, ctrl) => { +export const writeStream = ({ + data, + onClose, + onMessage, + onError, + ctrl +}: { + data: WriteParams + onMessage?: (res: any) => void + onError?: (...args: any[]) => void + onClose?: (...args: any[]) => void + ctrl: AbortController +}) => { // return request.post({ url: '/ai/write/generate-stream', data }) const token = getAccessToken() return fetchEventSource(`${config.base_url}/ai/write/generate-stream`, { diff --git a/src/views/ai/writer/components/Left.vue b/src/views/ai/writer/components/Left.vue index 9c3031ae..af808b15 100644 --- a/src/views/ai/writer/components/Left.vue +++ b/src/views/ai/writer/components/Left.vue @@ -13,7 +13,11 @@

{{ label }} - + {{ hint }} @@ -43,7 +47,7 @@ >