diff --git a/.prettierrc.json b/.prettierrc.json index a54eff92e87fbce476cb4030be64a16a1bd43d26..81ccd1f2f2fdde6aafa93592434c7fe814b2af26 100755 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,7 +1,14 @@ { - "arrowParens": "avoid", - "printWidth": 120, - "semi": true, - "singleQuote": true, - "tabWidth": 2 -} + "semi": true, + "singleQuote": true, + "quoteProps": "as-needed", + "trailingComma": "all", + "bracketSpacing": true, + "jsxBracketSameLine": true, + "arrowParens": "always", + "requirePragma": false, + "insertPragma": false, + "proseWrap": "preserve", + "htmlWhitespaceSensitivity": "ignore", + "embeddedLanguageFormatting": "auto" +} \ No newline at end of file diff --git a/src/App.vue b/src/App.vue index 46439d73c66da38b75e8c2b033614a79667d42d3..8211c6217b3262889fe8d70bf5004ffb1f1fe839 100644 --- a/src/App.vue +++ b/src/App.vue @@ -6,7 +6,10 @@ import DialogueView from 'src/views/dialogue/dialogueView.vue'; diff --git a/src/apis/appCenter/appCenterService.ts b/src/apis/appCenter/appCenterService.ts index 682a75284fea938fd57e3b917830553a156b565e..9ec8328b2c16aa7d3e272635b07cd7b3cd58e073 100644 --- a/src/apis/appCenter/appCenterService.ts +++ b/src/apis/appCenter/appCenterService.ts @@ -7,7 +7,9 @@ import { QueryAppListParamsType, CreateOrUpdateAppParamsType } from './type'; * @param params * @returns */ -export const queryAppList = (params: QueryAppListParamsType): Promise<[any, FcResponse | undefined]> => { +export const queryAppList = ( + params: QueryAppListParamsType, +): Promise<[any, FcResponse | undefined]> => { return get('/api/app', params); }; @@ -27,7 +29,9 @@ export const createOrUpdateApp = ( * @param params * @returns */ -export const querySingleAppData = (params: { id: string }): Promise<[any, FcResponse | undefined]> => { +export const querySingleAppData = (params: { + id: string; +}): Promise<[any, FcResponse | undefined]> => { return get(`/api/app/${params.id}`); }; @@ -36,7 +40,9 @@ export const querySingleAppData = (params: { id: string }): Promise<[any, FcResp * @param params * @returns */ -export const deleteSingleAppData = (params: { id: string }): Promise<[any, FcResponse | undefined]> => { +export const deleteSingleAppData = (params: { + id: string; +}): Promise<[any, FcResponse | undefined]> => { return del(`/api/app/${params.id}`, params); }; @@ -45,7 +51,9 @@ export const deleteSingleAppData = (params: { id: string }): Promise<[any, FcRes * @param params * @returns */ -export const releaseSingleAppData = (params: { id: string }): Promise<[any, FcResponse | undefined]> => { +export const releaseSingleAppData = (params: { + id: string; +}): Promise<[any, FcResponse | undefined]> => { return post(`/api/app/${params.id}`, params); }; @@ -54,8 +62,11 @@ export const releaseSingleAppData = (params: { id: string }): Promise<[any, FcRe * @param params * @returns */ -export const changeSingleAppCollect = (params: { id: string,favorited:boolean }): Promise<[any, FcResponse | undefined]> => { - return put(`/api/app/${params.id}`, {favorited:params.favorited}); +export const changeSingleAppCollect = (params: { + id: string; + favorited: boolean; +}): Promise<[any, FcResponse | undefined]> => { + return put(`/api/app/${params.id}`, { favorited: params.favorited }); }; /** @@ -63,11 +74,12 @@ export const changeSingleAppCollect = (params: { id: string,favorited:boolean }) * @param params * @returns */ -export const getPartAppConfgUser = (): Promise<[any, FcResponse | undefined]> => { - return get("/api/user"); +export const getPartAppConfgUser = (): Promise< + [any, FcResponse | undefined] +> => { + return get('/api/user'); }; - export const appCenterApi = { queryAppList, createOrUpdateApp, @@ -76,4 +88,4 @@ export const appCenterApi = { releaseSingleAppData, changeSingleAppCollect, getPartAppConfgUser, -} \ No newline at end of file +}; diff --git a/src/apis/appCenter/index.ts b/src/apis/appCenter/index.ts index 38c74110bb32ca5e3a568ec104e27a7163c05b8a..95d1ce017d353e0157bca4a5084afd72ec08da1a 100644 --- a/src/apis/appCenter/index.ts +++ b/src/apis/appCenter/index.ts @@ -1,4 +1,2 @@ // Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. export * from './appCenterService'; - - diff --git a/src/apis/appCenter/type.ts b/src/apis/appCenter/type.ts index 0b348bb8f9550d56f299c01e44f3bd07c3599691..ae30e0e98fe59bce2e0b1a64189e4f8feadd0cdd 100644 --- a/src/apis/appCenter/type.ts +++ b/src/apis/appCenter/type.ts @@ -1,97 +1,97 @@ export interface QueryAppListParamsType { - /** - * 筛选“我创建的”应用 - */ - createdByMe?: boolean; - /** - * 筛选“我收藏的”应用 - */ - favorited?: boolean; - /** - * 搜索关键字 - */ - keyword?: string; - /** - * 页码 - */ - page?: number; - /** - * 每页数量 - */ - pageSize?: number; - /** - * 搜索类型:全部字段或仅按名称/简介/作者字段;若不填,则视为 'all' - */ - searchType?: SearchType; - [property: string]: any; + /** + * 筛选“我创建的”应用 + */ + createdByMe?: boolean; + /** + * 筛选“我收藏的”应用 + */ + favorited?: boolean; + /** + * 搜索关键字 + */ + keyword?: string; + /** + * 页码 + */ + page?: number; + /** + * 每页数量 + */ + pageSize?: number; + /** + * 搜索类型:全部字段或仅按名称/简介/作者字段;若不填,则视为 'all' + */ + searchType?: SearchType; + [property: string]: any; } /** * 搜索类型:全部字段或仅按名称/简介/作者字段;若不填,则视为 'all' */ export enum SearchType { - All = "all", - Author = "author", - Description = "description", - Name = "name", + All = 'all', + Author = 'author', + Description = 'description', + Name = 'name', } /** * CreateAppRequest, 创建/更新应用请求数据结构 */ export interface CreateOrUpdateAppParamsType { - /** - * 应用ID - */ - appId?: string; - /** - * 应用简介 - */ - description?: string; - /** - * 对话轮次(1~10) - */ - dialogRounds?: number; - /** - * 图标 - */ - icon?: string; - /** - * 相关链接(URL列表,最多5项) - */ - links?: AppLink[]; - /** - * 应用名称 - */ - name?: string; - /** - * 权限配置 - */ - permission?: AppPermissionData; - /** - * 推荐问题(列表,最多3项) - */ - recommendedQuestions?: string[]; - /** - * 工作流(列表,每个元素为工作流ID) - */ - workflows?: string[]; - [property: string]: any; + /** + * 应用ID + */ + appId?: string; + /** + * 应用简介 + */ + description?: string; + /** + * 对话轮次(1~10) + */ + dialogRounds?: number; + /** + * 图标 + */ + icon?: string; + /** + * 相关链接(URL列表,最多5项) + */ + links?: AppLink[]; + /** + * 应用名称 + */ + name?: string; + /** + * 权限配置 + */ + permission?: AppPermissionData; + /** + * 推荐问题(列表,最多3项) + */ + recommendedQuestions?: string[]; + /** + * 工作流(列表,每个元素为工作流ID) + */ + workflows?: string[]; + [property: string]: any; } /** * AppLink, 应用链接数据结构 */ export interface AppLink { - /** - * 链接标题 - */ - title?: string; - /** - * 链接地址 - */ - url: string; - [property: string]: any; + /** + * 链接标题 + */ + title?: string; + /** + * 链接地址 + */ + url: string; + [property: string]: any; } /** @@ -100,16 +100,16 @@ export interface AppLink { * AppPermissionData, 应用权限配置数据结构 */ export interface AppPermissionData { - /** - * 附加人员名单(如果可见性为部分人可见) - */ - authorizedUsers?: string[]; - visibility: Visibility; - [property: string]: any; + /** + * 附加人员名单(如果可见性为部分人可见) + */ + authorizedUsers?: string[]; + visibility: Visibility; + [property: string]: any; } export enum Visibility { - Private = "private", - Protected = "protected", - Public = "public", + Private = 'private', + Protected = 'protected', + Public = 'public', } diff --git a/src/apis/index.ts b/src/apis/index.ts index 1f31eb50f5c577adc5db04d3d887d44a1dd166d6..859159858c830cb67fa914f44b013681c1771c3f 100644 --- a/src/apis/index.ts +++ b/src/apis/index.ts @@ -7,7 +7,15 @@ // IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR // PURPOSE. // See the Mulan PSL v2 for more details. -import { accountApi, sessionApi, externalApi, apiKeyApi, knowledgeApi, appApi, apiApi } from './paths'; +import { + accountApi, + sessionApi, + externalApi, + apiKeyApi, + knowledgeApi, + appApi, + apiApi, +} from './paths'; import { workFlowApi } from './workFlow'; import { appCenterApi } from './appCenter'; diff --git a/src/apis/paths/account.ts b/src/apis/paths/account.ts index e14d2ca7dc971d77a0b5d8b372f04e5f7f1fc8bb..6ff6b4c230bfba8c2004ba9390adbb4e4583a534 100644 --- a/src/apis/paths/account.ts +++ b/src/apis/paths/account.ts @@ -19,13 +19,13 @@ export const authorizeUser = (): Promise< any, ( | FcResponse<{ - user_sub: string; - username: string; - organization: string; - revision_number: string | null; - }> + user_sub: string; + username: string; + organization: string; + revision_number: string | null; + }> | undefined - ) + ), ] > => { return get('/api/auth/user'); @@ -35,7 +35,9 @@ export const authorizeUser = (): Promise< * 退出登录 * @returns */ -export const authorizeLogout = (): Promise<[any, FcResponse | undefined]> => { +export const authorizeLogout = (): Promise< + [any, FcResponse | undefined] +> => { return get('/api/auth/logout'); }; @@ -44,20 +46,19 @@ export const authorizeLogout = (): Promise<[any, FcResponse | undefined * @returns */ export const login = ( - code: string + code: string, ): Promise< [ any, ( | FcResponse<{ - csrf_token: string; - }> + csrf_token: string; + }> | undefined - ) + ), ] > => { return get('/api/auth/login', { code }); - }; /** @@ -72,10 +73,10 @@ export const userLogin = ( any, ( | FcResponse<{ - csrf_token: string; - }> + csrf_token: string; + }> | undefined - ) + ), ] > => { return get('/api/auth/login', { passwd, account }); @@ -90,10 +91,10 @@ export const refreshToken = (): Promise< any, ( | FcResponse<{ - csrf_token: string; - }> + csrf_token: string; + }> | undefined - ) + ), ] > => { return get('/api/auth/refresh_token'); @@ -105,29 +106,30 @@ export const refreshToken = (): Promise< * @returns */ export const updateRevision = ( - revisionNumber: number | string + revisionNumber: number | string, ): Promise< [ any, ( | FcResponse<{ - user_sub: string; - username: string; - organization: string; - revision_number: string | null; - }> + user_sub: string; + username: string; + organization: string; + revision_number: string | null; + }> | undefined - ) + ), ] > => { - return post('/api/auth/update_revision_number', { revision_num: revisionNumber }); + return post('/api/auth/update_revision_number', { + revision_num: revisionNumber, + }); }; - function queryAuthUrl(action: string) { return get<{ url: string; - }>('/api/auth/redirect',{action}); + }>('/api/auth/redirect', { action }); } export const accountApi = { @@ -137,5 +139,5 @@ export const accountApi = { userLogin, refreshToken, updateRevision, - queryAuthUrl + queryAuthUrl, }; diff --git a/src/apis/paths/api.ts b/src/apis/paths/api.ts index e20012b69ef5124744dbc47f9996eee9930d30f6..8538d5dcf1975fed1ddb6797bdae9121c46bc0da 100644 --- a/src/apis/paths/api.ts +++ b/src/apis/paths/api.ts @@ -8,7 +8,9 @@ import { QueryApiListParamsType, CreateOrUpdateApiParamsType } from './type'; * @returns */ // 导出一个函数queryApiList,用于查询API列表 -export const queryApiList = (params: QueryApiListParamsType): Promise<[any, FcResponse | undefined]> => { +export const queryApiList = ( + params: QueryApiListParamsType, +): Promise<[any, FcResponse | undefined]> => { // 调用get函数,传入/api/service路径和params参数,返回一个Promise对象 return get('/api/service', params); }; @@ -29,8 +31,11 @@ export const createOrUpdateApi = ( * @param params * @returns */ -export const querySingleApiData = (params: { serviceId: string,edit?: boolean}): Promise<[any, FcResponse | undefined]> => { - return get(`/api/service/${params.serviceId}`,{edit: params.edit}); +export const querySingleApiData = (params: { + serviceId: string; + edit?: boolean; +}): Promise<[any, FcResponse | undefined]> => { + return get(`/api/service/${params.serviceId}`, { edit: params.edit }); }; /** @@ -38,7 +43,9 @@ export const querySingleApiData = (params: { serviceId: string,edit?: boolean}): * @param params * @returns */ -export const deleteSingleApiData = (params: { serviceId: string }): Promise<[any, FcResponse | undefined]> => { +export const deleteSingleApiData = (params: { + serviceId: string; +}): Promise<[any, FcResponse | undefined]> => { return del(`/api/service/${params.serviceId}`, params); }; @@ -47,13 +54,18 @@ export const deleteSingleApiData = (params: { serviceId: string }): Promise<[any * @param params * @returns */ -export const changeSingleApiCollect = (params: { serviceId: string,favorited:boolean }): Promise<[any, FcResponse | undefined]> => { - return put(`/api/service/${params.serviceId}`, {favorited:params.favorited}); +export const changeSingleApiCollect = (params: { + serviceId: string; + favorited: boolean; +}): Promise<[any, FcResponse | undefined]> => { + return put(`/api/service/${params.serviceId}`, { + favorited: params.favorited, + }); }; export const apiApi = { queryApiList, createOrUpdateApi, querySingleApiData, deleteSingleApiData, - changeSingleApiCollect -}; \ No newline at end of file + changeSingleApiCollect, +}; diff --git a/src/apis/paths/apikey.ts b/src/apis/paths/apikey.ts index aa26beefd0f5b3fb139934ae60d070ddbe7a45a7..ac2cdb92720bcf79877d9414a6d918fa3060ea1f 100644 --- a/src/apis/paths/apikey.ts +++ b/src/apis/paths/apikey.ts @@ -14,16 +14,7 @@ import type { FcResponse } from 'src/apis/server'; * 验证用户信息 * @returns */ -export const getApiKey = (): Promise< - [ - any, - ( - | FcResponse<{ - }> - | undefined - ) - ] -> => { +export const getApiKey = (): Promise<[any, FcResponse<{}> | undefined]> => { return get('/api/auth/key'); }; @@ -34,21 +25,9 @@ export const getApiKey = (): Promise< export const changeApiKey = (params: { action: string; query?: string; -} - ): Promise< - [ - any, - ( - | FcResponse<{ - }> - | undefined - ) - ] - > => { - return post('/api/auth/key', params,params); - }; - - +}): Promise<[any, FcResponse<{}> | undefined]> => { + return post('/api/auth/key', params, params); +}; export const apiKeyApi = { getApiKey, diff --git a/src/apis/paths/app.ts b/src/apis/paths/app.ts index bc903f65a3de622406636c75fcd161e16a3d67dd..3a87663be2ee3a4f15d8da921df5acb2f1bd7ada 100644 --- a/src/apis/paths/app.ts +++ b/src/apis/paths/app.ts @@ -13,21 +13,15 @@ import { Application } from './type'; type App = { applications: Application[]; -} +}; /** - * 获取最近 top5 应用 + * 获取最近 top5 应用 * @returns */ -export const getTopFiveApp = (count: number): Promise< - [ - any, - ( - | FcResponse - | undefined - ) - ] -> => { - return get('/api/app/recent',{count}); +export const getTopFiveApp = ( + count: number, +): Promise<[any, FcResponse | undefined]> => { + return get('/api/app/recent', { count }); }; export const appApi = { diff --git a/src/apis/paths/conversation.ts b/src/apis/paths/conversation.ts index 8c51fc98aea37063ba7de225ba0d45c4acfbffd8..5989189e578dc21b5da133c90aec4157e0e8678b 100644 --- a/src/apis/paths/conversation.ts +++ b/src/apis/paths/conversation.ts @@ -25,7 +25,7 @@ export const stopGeneration = (): Promise< // conversationId: string; }> | undefined - ) + ), ] > => { return post(`/api/stop`); @@ -36,13 +36,7 @@ export const stopGeneration = (): Promise< * @returns */ export const getSessionRecord = (): Promise< - [ - any, - ( - | FcResponse - | undefined - ) - ] + [any, FcResponse | undefined] > => { return get(BASE_URL); }; @@ -59,24 +53,19 @@ export const createSession = (): Promise< conversationId: string; }> | undefined - ) + ), ] > => { return post(BASE_URL); }; - /** * 创建工作流debug会话 * @param params * @returns */ -export const createSessionDebug = (params:any): Promise< -[ - any, any -] -> => { - return post(`/api/conversation?debug=${params.debug}`) +export const createSessionDebug = (params: any): Promise<[any, any]> => { + return post(`/api/conversation?debug=${params.debug}`); }; /** * 更新会话标题 @@ -87,12 +76,10 @@ export const createSessionDebug = (params:any): Promise< * } * @returns */ -export const updateSession = ( - params: { - conversationId: string, - title: string, - }, -): Promise< +export const updateSession = (params: { + conversationId: string; + title: string; +}): Promise< [ any, ( @@ -102,14 +89,18 @@ export const updateSession = ( }> > | undefined - ) + ), ] > => { - return put(BASE_URL, { - title: params.title, - }, { - conversationId: params.conversationId, - }); + return put( + BASE_URL, + { + title: params.title, + }, + { + conversationId: params.conversationId, + }, + ); }; /** @@ -119,30 +110,23 @@ export const updateSession = ( */ export const deleteSession = (data: { conversationList: string[]; -}): Promise<[any, FcResponse> | undefined]> => { +}): Promise< + [any, FcResponse> | undefined] +> => { return del(`${BASE_URL}`, data); }; /** * 获取会话历史对话记录 - * @param conversationId + * @param conversationId * GET /api/record/eccb08c3-0621-4602-a4d2-4eaada892557 */ export const getHistoryConversation = ( - conversationId: string -): Promise< - [ - any, - ( - | FcResponse - | undefined - ) - ] -> => { + conversationId: string, +): Promise<[any, FcResponse | undefined]> => { // return get('/api/record', { conversationId: conversationId }); - return get('/api/record/'+ conversationId); + return get('/api/record/' + conversationId); // 修改 chat 格式 - }; /** @@ -157,7 +141,8 @@ export const commentConversation = (params: { reasonLink?: string; reasonDescription?: string; }): Promise<[any, FcResponse> | undefined]> => { - const { qaRecordId, isLike, dislikeReason, reasonLink, reasonDescription } = params; + const { qaRecordId, isLike, dislikeReason, reasonLink, reasonDescription } = + params; return post(`/api/comment`, { record_id: qaRecordId, is_like: isLike, @@ -176,11 +161,11 @@ export const getRecognitionMode = (): Promise< id: string; name: string; description: string; - auth:any; + auth: any; }> > | undefined - ) + ), ] > => { return get('/api/plugin'); @@ -198,7 +183,7 @@ export enum UploadStatus { export const getUploadFiles = ( sessionId: string, used = true, - unused = true + unused = true, ): Promise< [ any, @@ -209,12 +194,16 @@ export const getUploadFiles = ( name: string; type: string; size: number; - status: UploadStatus.USED | UploadStatus.UNUSED | UploadStatus.RESOLVING | UploadStatus.RESOLVEFAIL; + status: + | UploadStatus.USED + | UploadStatus.UNUSED + | UploadStatus.RESOLVING + | UploadStatus.RESOLVEFAIL; created_at: number; }>; }> | undefined - ) + ), ] > => { return get(`/api/document/${sessionId}`, { used, unused }); @@ -222,7 +211,7 @@ export const getUploadFiles = ( export const uploadFiles = ( formData, - sessionId + sessionId, ): Promise< [ any, @@ -231,16 +220,21 @@ export const uploadFiles = ( documents: Array; }> | undefined - ) + ), ] > => { - return post(`/api/document/${sessionId}`, formData, {}, { - 'Content-Type': 'multipart/form-data', - }); + return post( + `/api/document/${sessionId}`, + formData, + {}, + { + 'Content-Type': 'multipart/form-data', + }, + ); }; export const deleteUploadedFile = ( - documentId: any + documentId: any, ): Promise<[any, FcResponse | undefined]> => { return del(`/api/document/${documentId}`); }; diff --git a/src/apis/paths/external.ts b/src/apis/paths/external.ts index cde11a662bcf4be05214679830d692624b55b237..d46588efafc0d15f9a2aa62dd08fae334c3e30be 100644 --- a/src/apis/paths/external.ts +++ b/src/apis/paths/external.ts @@ -37,5 +37,6 @@ export const report = (params: { }; export const externalApi = { - feedback,report + feedback, + report, }; diff --git a/src/apis/paths/index.ts b/src/apis/paths/index.ts index 0b0570c84404cfd979f757dc946b1c32acc95c45..17d6d4b602720cb8515517f3cf0fd2e1ef654a94 100644 --- a/src/apis/paths/index.ts +++ b/src/apis/paths/index.ts @@ -13,4 +13,4 @@ export * from './external'; export * from './apikey'; export * from './knowledge'; export * from './app'; -export * from './api'; \ No newline at end of file +export * from './api'; diff --git a/src/apis/paths/knowledge.ts b/src/apis/paths/knowledge.ts index d59c477bf95a35b551387c04b0418665784a68f9..8016773ede2a22bcf8dadc39e4fcfb7978d8633d 100644 --- a/src/apis/paths/knowledge.ts +++ b/src/apis/paths/knowledge.ts @@ -15,20 +15,11 @@ import type { FcResponse } from 'src/apis/server'; * @returns */ export const updateKnowledgeList = (params: { - kb_id: string; - }): Promise< - [ - any, - ( - | FcResponse<{ - }> - | undefined - ) - ] - > => { - return post('/api/knowledge', params); - }; + kb_id: string; +}): Promise<[any, FcResponse<{}> | undefined]> => { + return post('/api/knowledge', params); +}; export const knowledgeApi = { - updateKnowledgeList, + updateKnowledgeList, }; diff --git a/src/apis/paths/type.ts b/src/apis/paths/type.ts index 24b5c2dd6779664bbbe7370f9418da57a3a3e440..b4d1ce0991c9c3aac33d7375dc959e01a7efeb61 100644 --- a/src/apis/paths/type.ts +++ b/src/apis/paths/type.ts @@ -1,66 +1,66 @@ // 定义文件信息的接口 export interface File { - id: string; - name: string; - type: string; - size: number; + id: string; + name: string; + type: string; + size: number; } // 定义流程步骤的接口 export interface Step { - step_name: string; - step_status: string; - input: { - cve_id: string; - isFixed: boolean; - }; - output: { - code: number; - data: any[]; // 可以根据具体情况细化这个类型 - }; + step_name: string; + step_status: string; + input: { + cve_id: string; + isFixed: boolean; + }; + output: { + code: number; + data: any[]; // 可以根据具体情况细化这个类型 + }; } // 定义流程信息的接口 export interface Flow { - appId: string; - flowId: string; - steps: Step[]; + appId: string; + flowId: string; + steps: Step[]; } // 定义内容信息的接口 export interface Content { - question: string; - answer: string; - data: any; // 可以根据具体情况细化这个类型 + question: string; + answer: string; + data: any; // 可以根据具体情况细化这个类型 } /** * 定义元数据信息的接口 - * + * * @property {number} inputTokens - 输入的token数量,表示prompt的token数量。 * @property {number} outputTokens - 输出的token数量,表示大模型生成的token数量。 * @property {number} timeCost - 运行时间,单位为秒,最多保留两位小数。 */ export interface Metadata { - inputTokens: number; - outputTokens: number; - timeCost: number; + inputTokens: number; + outputTokens: number; + timeCost: number; } // 定义问答对数据结构 export interface ConversationRecord { - id: string; - groupId: string; - conversationId: string; - files: File[]; - flow: Flow; - content: Content; - metadata: Metadata; + id: string; + groupId: string; + conversationId: string; + files: File[]; + flow: Flow; + content: Content; + metadata: Metadata; } // 定义对话内问答列表数据结构 export interface ConversationRecordList { - records: ConversationRecord[]; + records: ConversationRecord[]; } /* 推荐问题的格式 @@ -70,134 +70,134 @@ export interface ConversationRecordList { * "question": "查询机器192.168.10.1的CVE信息", //推荐问题的内容 */ export interface Suggest { - appId: string, - flowId: string, - flow_description: string, - question: string, + appId: string; + flowId: string; + flow_description: string; + question: string; } /* * 问答列表内项的数据结构 */ export interface ConversationListItem { - conversationId: string, - createdTime: string, - docCount: number, - title: string, + conversationId: string; + createdTime: string; + docCount: number; + title: string; } /* * 问答列表数据结构 */ export interface ConversationList { - conversations: Array; + conversations: Array; } /* * 语义接口数据结构 */ export interface Application { - appId: string, - name: string, + appId: string; + name: string; } /* * 语义接口数据结构 */ export interface ApiMessage { - apiId: string, - name: string, - type: string, - path: string, - description: string, + apiId: string; + name: string; + type: string; + path: string; + description: string; } /* * 语义接口数据结构 */ export interface Service { - serviceId: string, - name: string, - icon: string, - author: string, - description: string, - favorite: boolean, + serviceId: string; + name: string; + icon: string; + author: string; + description: string; + favorite: boolean; } export interface QueryApiListParamsType { - /** - * 筛选“我创建的”语义接口 - */ - createdByMe?: boolean; - /** - * 筛选“我收藏的”语义接口 - */ - favorited?: boolean; - /** - * 搜索关键字 - */ - keyword?: string; - /** - * 页码 - */ - page?: number; - /** - * 每页数量 - */ - pageSize?: number; - /** - * 搜索类型:全部字段或仅按名称/简介/作者字段;若不填,则视为 'all' - */ - searchType?: SearchType; - [property: string]: any; + /** + * 筛选“我创建的”语义接口 + */ + createdByMe?: boolean; + /** + * 筛选“我收藏的”语义接口 + */ + favorited?: boolean; + /** + * 搜索关键字 + */ + keyword?: string; + /** + * 页码 + */ + page?: number; + /** + * 每页数量 + */ + pageSize?: number; + /** + * 搜索类型:全部字段或仅按名称/简介/作者字段;若不填,则视为 'all' + */ + searchType?: SearchType; + [property: string]: any; } /** * 搜索类型:全部字段或仅按名称/简介/作者字段;若不填,则视为 'all' */ export enum SearchType { - All = "all", - Author = "author", - Description = "description", - Name = "name", + All = 'all', + Author = 'author', + Description = 'description', + Name = 'name', } /** * CreateAppRequest, 创建/更新语义接口请求数据结构 */ export interface CreateOrUpdateApiParamsType { - /** - * 语义接口ID - */ - serviceId?: string; - /** - * 语义接口yaml 文件(json 格式) - */ - data?: string; - /** - * 对话轮次(1~10) - */ - [property: string]: any; + /** + * 语义接口ID + */ + serviceId?: string; + /** + * 语义接口yaml 文件(json 格式) + */ + data?: string; + /** + * 对话轮次(1~10) + */ + [property: string]: any; } /** * serviceApiData, 获取语义接口返回数据结构 */ -export interface serviceApiData{ - /** - * 语义接口名称 - */ - name?: string; - /** - * 语义接口path - */ - path?: string; - /** - * 语义接口描述 - */ - description?: string; - /** - * 对话轮次(1~10) - */ - [property: string]: any; +export interface serviceApiData { + /** + * 语义接口名称 + */ + name?: string; + /** + * 语义接口path + */ + path?: string; + /** + * 语义接口描述 + */ + description?: string; + /** + * 对话轮次(1~10) + */ + [property: string]: any; } diff --git a/src/apis/server.ts b/src/apis/server.ts index d17aa139754594258fe522f2b44488821e49c54f..16a5c1f9e9359a5d14cc48464c4c3a5c0b18e2b1 100644 --- a/src/apis/server.ts +++ b/src/apis/server.ts @@ -10,7 +10,12 @@ import axios from 'axios'; import { IconError } from '@computing/opendesign-icons'; import { handleChangeRequestHeader, handleStatusError } from './tools'; -import type { AxiosResponse, InternalAxiosRequestConfig, AxiosError, AxiosHeaders } from 'axios'; +import type { + AxiosResponse, + InternalAxiosRequestConfig, + AxiosError, + AxiosHeaders, +} from 'axios'; import { ElMessage } from 'element-plus'; export interface FcResponse { @@ -39,10 +44,12 @@ export const server = axios.create({ server.interceptors.request.use( ( config: InternalAxiosRequestConfig, - ): InternalAxiosRequestConfig | Promise> => { + ): + | InternalAxiosRequestConfig + | Promise> => { return handleChangeRequestHeader(config); }, - error => { + (error) => { return Promise.reject(error); }, ); @@ -82,7 +89,10 @@ server.interceptors.response.use( * @param params * @constructor */ -export const get = async (url: string, params: IAnyObj = {}): Promise<[IError, FcResponse | undefined]> => { +export const get = async ( + url: string, + params: IAnyObj = {}, +): Promise<[IError, FcResponse | undefined]> => { try { const result = await server.get(url, { params: params }); return [null, result.data as FcResponse]; @@ -105,7 +115,10 @@ export const post = async ( headers: IAnyObj = {}, ): Promise<[IError, FcResponse | undefined]> => { try { - const result = await server.post(url, data, { params: params, headers: headers as AxiosHeaders }); + const result = await server.post(url, data, { + params: params, + headers: headers as AxiosHeaders, + }); return [null, result.data as FcResponse]; } catch (error) { return [error as IError, undefined]; diff --git a/src/apis/tools.ts b/src/apis/tools.ts index 2e51c733c75e34e100e4f148011652e8e46a4a72..81f85f83bde3b22dc767cbecce5a0b9df4eae795 100644 --- a/src/apis/tools.ts +++ b/src/apis/tools.ts @@ -8,25 +8,36 @@ // PURPOSE. // See the Mulan PSL v2 for more details. import { ElNotification, ElMessageBox } from 'element-plus'; -import { CALLBACK_URL, LOGOUT_CALLBACK_URL } from 'src/views/dialogue/constants'; +import { + CALLBACK_URL, + LOGOUT_CALLBACK_URL, +} from 'src/views/dialogue/constants'; import { useAccountStore } from 'src/store'; -import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper' +import { qiankunWindow } from 'vite-plugin-qiankun/dist/helper'; -import type { AxiosError, AxiosResponse, InternalAxiosRequestConfig } from 'axios'; +import type { + AxiosError, + AxiosResponse, + InternalAxiosRequestConfig, +} from 'axios'; import { storeToRefs } from 'pinia'; -import i18n from 'src/i18n' +import i18n from 'src/i18n'; import { errorMsg } from 'src/components/Message'; function getCookie(name: string) { - let matches = document.cookie.match(new RegExp( - "(?:^|; )" + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + "=([^;]*)" - )); + let matches = document.cookie.match( + new RegExp( + '(?:^|; )' + + name.replace(/([\.$?*|{}\(\)\[\]\\\/\+^])/g, '\\$1') + + '=([^;]*)', + ), + ); return matches ? decodeURIComponent(matches[1]) : undefined; } // 修改请求头 export const handleChangeRequestHeader = ( - config: InternalAxiosRequestConfig + config: InternalAxiosRequestConfig, ): InternalAxiosRequestConfig => { if (config.headers['Content-Type'] !== 'multipart/form-data') { config.headers['Content-Type'] = 'application/json; charset=UTF-8'; @@ -38,49 +49,50 @@ export const handleChangeRequestHeader = ( return config; }; - export const handleAuthorize = async (errStatus: number): Promise => { const type = import.meta.env.VITE_USER_TYPE; - const store = useAccountStore() + const store = useAccountStore(); const { userinfo } = storeToRefs(store); userinfo.value.organization = type; - if ((errStatus === 401 || errStatus === 403)) { + if (errStatus === 401 || errStatus === 403) { if (qiankunWindow.__POWERED_BY_QIANKUN__) { - const url = await store.getAuthUrl('login') + const url = await store.getAuthUrl('login'); if (url) { - const redirectUrl = qiankunWindow.__POWERED_BY_QIANKUN__ ? `${url}&redirect_index=${location.href}` : url - if (redirectUrl) - window.location.href = redirectUrl + const redirectUrl = qiankunWindow.__POWERED_BY_QIANKUN__ + ? `${url}&redirect_index=${location.href}` + : url; + if (redirectUrl) window.location.href = redirectUrl; } } else { - ElMessageBox.confirm(i18n.global.t('Login.unauthorized'), i18n.global.t('history.confirmation_message1'), { - confirmButtonText: i18n.global.t('Login.login'), - showClose: false, - showCancelButton: false, - autofocus: false, - closeOnClickModal: false, - closeOnPressEscape: false, - }).then(async () => { - const url = await store.getAuthUrl('login') + ElMessageBox.confirm( + i18n.global.t('Login.unauthorized'), + i18n.global.t('history.confirmation_message1'), + { + confirmButtonText: i18n.global.t('Login.login'), + showClose: false, + showCancelButton: false, + autofocus: false, + closeOnClickModal: false, + closeOnPressEscape: false, + }, + ).then(async () => { + const url = await store.getAuthUrl('login'); if (url) { - const redirectUrl = qiankunWindow.__POWERED_BY_QIANKUN__ ? `${url}&redirect_index=${location.href}` : url - if (redirectUrl) - window.location.href = redirectUrl + const redirectUrl = qiankunWindow.__POWERED_BY_QIANKUN__ + ? `${url}&redirect_index=${location.href}` + : url; + if (redirectUrl) window.location.href = redirectUrl; } - } - ); + }); } - } if (errStatus === 460) { window.open(LOGOUT_CALLBACK_URL, '_self'); - } - else{ + } else { // errorMsg(`${errStatus} is error`); } }; - export const handleNetworkError = (errStatus: number): void => { let errMessage: string; if (errStatus) { @@ -134,9 +146,15 @@ export const handleNetworkError = (errStatus: number): void => { export const handleGeneralError = ( errno: number, errorLabel: string = 'Fail', - errMessage: string = 'request error' + errMessage: string = 'request error', ): boolean => { - if (Number(errno) !== 200 && Number(errno) !== 401 && Number(errno) !== 403 && Number(errno) !== 302 && Number(errno) !== 2001) { + if ( + Number(errno) !== 200 && + Number(errno) !== 401 && + Number(errno) !== 403 && + Number(errno) !== 302 && + Number(errno) !== 2001 + ) { ElNotification.error({ title: errorLabel, message: errMessage, @@ -146,17 +164,14 @@ export const handleGeneralError = ( return true; }; - - - /** * 处理状态码错误 */ export const handleStatusError = async ( - error: AxiosError + error: AxiosError, ): Promise[] | undefined> => { if (!error.response) { - // 如果没有响应,可能是网络问题或其他非HTTP错误,直接返回错误 + // 如果没有响应,可能是网络问题或其他非HTTP错误,直接返回错误 return Promise.reject(error); } @@ -184,4 +199,4 @@ export const handleStatusError = async ( // return server(originalRequest); } return Promise.reject(error.response); -}; \ No newline at end of file +}; diff --git a/src/apis/workFlow/type.ts b/src/apis/workFlow/type.ts index 94bbe0ac6b92f315c42c7c65d4f4cb3564ec6ff3..6769ea7832adac0b5084ef382a6289b631a53ad9 100644 --- a/src/apis/workFlow/type.ts +++ b/src/apis/workFlow/type.ts @@ -1,116 +1,115 @@ export interface CreateOrUpdateFlowParamsType { - appId: string; - flowId: string; - topologyCheck?: boolean; - [property: string]: any; + appId: string; + flowId: string; + topologyCheck?: boolean; + [property: string]: any; } - /** * Flow */ export interface CreateOrUpdataFlowBodyType { - /** - * 流创建时间 - */ - createdAt: string; - /** - * 流的介绍 - */ - description: string; - edges: Edge[]; - editable: string; - /** - * 流是否启用 - */ - enable: boolean; - /** - * 流id - */ - flowId?: string; - /** - * 流的名称 - */ - name: string; - nodes: Node[]; - [property: string]: any; + /** + * 流创建时间 + */ + createdAt: string; + /** + * 流的介绍 + */ + description: string; + edges: Edge[]; + editable: string; + /** + * 流是否启用 + */ + enable: boolean; + /** + * 流id + */ + flowId?: string; + /** + * 流的名称 + */ + name: string; + nodes: Node[]; + [property: string]: any; } /** * Edge */ export interface Edge { - /** - * 边对应的分支id - */ - branchId: string; - /** - * 边创建的时间 - */ - createdAt?: string; - /** - * 边的id - */ - edgeId: string; - /** - * 源节点的id - */ - sourceNode: string; - /** - * 目标节点的id - */ - targetNode: string; - /** - * 边的类型 - */ - type: string; - [property: string]: any; + /** + * 边对应的分支id + */ + branchId: string; + /** + * 边创建的时间 + */ + createdAt?: string; + /** + * 边的id + */ + edgeId: string; + /** + * 源节点的id + */ + sourceNode: string; + /** + * 目标节点的id + */ + targetNode: string; + /** + * 边的类型 + */ + type: string; + [property: string]: any; } /** * Node */ export interface Node { - /** - * 节点对应apiId - */ - apiId: string; - /** - * 节点创建时间 - */ - createdAt?: string; - /** - * 节点的伴生节点(例如for的begin和end) - */ - dependency?: Dependency; - /** - * 节点介绍 - */ - description: string; - /** - * 节点是否可被编辑/删除 - */ - editable: boolean; - /** - * 节点是否被启用 - */ - enable: boolean; - /** - * 节点名称 - */ - name: string; - /** - * 节点id - */ - nodeId: string; - parameters?: Parameters; - /** - * 节点的位置 - */ - position: Position; - serviceId: string; - type: string; - [property: string]: any; + /** + * 节点对应apiId + */ + apiId: string; + /** + * 节点创建时间 + */ + createdAt?: string; + /** + * 节点的伴生节点(例如for的begin和end) + */ + dependency?: Dependency; + /** + * 节点介绍 + */ + description: string; + /** + * 节点是否可被编辑/删除 + */ + editable: boolean; + /** + * 节点是否被启用 + */ + enable: boolean; + /** + * 节点名称 + */ + name: string; + /** + * 节点id + */ + nodeId: string; + parameters?: Parameters; + /** + * 节点的位置 + */ + position: Position; + serviceId: string; + type: string; + [property: string]: any; } /** @@ -119,29 +118,29 @@ export interface Node { * Dependency */ export interface Dependency { - nodeId: string; - type: string; - [property: string]: any; + nodeId: string; + type: string; + [property: string]: any; } export interface Parameters { - /** - * 节点类型为choice时才存在这个变量 - */ - choices?: Choice[]; - [property: string]: any; + /** + * 节点类型为choice时才存在这个变量 + */ + choices?: Choice[]; + [property: string]: any; } /** * choice */ export interface Choice { - /** - * ID 编号 - */ - branch: string; - description: string; - [property: string]: any; + /** + * ID 编号 + */ + branch: string; + description: string; + [property: string]: any; } /** @@ -150,13 +149,13 @@ export interface Choice { * Position */ export interface Position { - /** - * 前端显示相对位置的x坐标 - */ - x: number; - /** - * 前端显示相对位置的y坐标 - */ - y: number; - [property: string]: any; -} \ No newline at end of file + /** + * 前端显示相对位置的x坐标 + */ + x: number; + /** + * 前端显示相对位置的y坐标 + */ + y: number; + [property: string]: any; +} diff --git a/src/apis/workFlow/workFlowService.ts b/src/apis/workFlow/workFlowService.ts index 992f6b3c216fb1acf8151b590dbfa56b64727a0a..d6b6a39fdcd5aa989d926834a050b611c2ea6a47 100644 --- a/src/apis/workFlow/workFlowService.ts +++ b/src/apis/workFlow/workFlowService.ts @@ -1,7 +1,10 @@ // Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. import { post, get, del, put } from 'src/apis/server'; import type { FcResponse } from 'src/apis/server'; -import { CreateOrUpdateFlowParamsType, CreateOrUpdataFlowBodyType } from './type'; +import { + CreateOrUpdateFlowParamsType, + CreateOrUpdataFlowBodyType, +} from './type'; /** * 获取所有服务 * @param params diff --git a/src/assets/base.css b/src/assets/base.css index da4ea226c58a2b7ec1fdc3890ac9e454496bb98e..2d43f5aefffb810d19d2731d713687bf3f576344 100644 --- a/src/assets/base.css +++ b/src/assets/base.css @@ -5,8 +5,9 @@ font-style: normal; } * { - font-family: HarmonyOS_Sans_SC_Medium, 'Helvetica Neue', Helvetica, 'PingFang SC', - 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, sans-serif; + font-family: HarmonyOS_Sans_SC_Medium, 'Helvetica Neue', Helvetica, + 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', '微软雅黑', Arial, + sans-serif; } *, @@ -27,16 +28,29 @@ svg:focus { outline: none; } -html{ +html { overflow: hidden; } body { min-width: 1366px; min-height: 100vh; - transition: color 0.5s, background-color 0.5s; - font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, - Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; + transition: + color 0.5s, + background-color 0.5s; + font-family: + Inter, + -apple-system, + BlinkMacSystemFont, + 'Segoe UI', + Roboto, + Oxygen, + Ubuntu, + Cantarell, + 'Fira Sans', + 'Droid Sans', + 'Helvetica Neue', + sans-serif; font-size: 15px; text-rendering: optimizeLegibility; background-color: #f5f5f6; diff --git a/src/assets/color.js b/src/assets/color.js index 5a19ae43380f1936b2efe643f5859b3d6af21110..1b1248f953e530adda2f0a69afc004f23d4a6035 100644 --- a/src/assets/color.js +++ b/src/assets/color.js @@ -1,15 +1,14 @@ const color = [ - "#0062DC", - "#2DB47C", - "#EC4F83", - "#3DB6FC", - "#6D47F5", - "#3DCFD4", - "#BD45E8", - "#81BA06", - "#FF5432", - "#9EA8B9", - ]; - - export default color; - \ No newline at end of file + '#0062DC', + '#2DB47C', + '#EC4F83', + '#3DB6FC', + '#6D47F5', + '#3DCFD4', + '#BD45E8', + '#81BA06', + '#FF5432', + '#9EA8B9', +]; + +export default color; diff --git a/src/assets/styles/codePreview.scss b/src/assets/styles/codePreview.scss index 7783c926014df6f2ea6c2095522f09685e598ff1..609ff33a7e8162700264ae895ca436c5674836dd 100644 --- a/src/assets/styles/codePreview.scss +++ b/src/assets/styles/codePreview.scss @@ -1,10 +1,9 @@ #markdown-preview { - - .hljs{ + .hljs { color: var(--o-text-color-secondary); } //markdown text size - p{ + p { font-size: 16px; font-weight: 400; } @@ -88,8 +87,19 @@ align-items: center; border-radius: 8px 8px 0 0; padding: 8px 12px 0 12px; - font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, - Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif; + font-family: + Inter, + -apple-system, + BlinkMacSystemFont, + 'Segoe UI', + Roboto, + Oxygen, + Ubuntu, + Cantarell, + 'Fira Sans', + 'Droid Sans', + 'Helvetica Neue', + sans-serif; .pre-copy { cursor: pointer; svg { @@ -115,7 +125,7 @@ ol { margin-left: 16px; - li{ + li { list-style-type: decimal; cursor: default; margin-left: 12px; diff --git a/src/assets/styles/element/index.scss b/src/assets/styles/element/index.scss index 25b93d1e41b671c4a662cd607b277741f8d45960..02d71a9c2be4d014865878912f88f2fdebaf9018 100644 --- a/src/assets/styles/element/index.scss +++ b/src/assets/styles/element/index.scss @@ -2,7 +2,6 @@ --el-color-primary: #0077ff; } - .euler-copilot-message-box { background-color: #fefefe; border-radius: 4px; @@ -14,65 +13,62 @@ .el-message-box { width: 432px !important; - height: 184px !important; + height: 184px !important; } -.el-button:not(.is-disabled){ +.el-button:not(.is-disabled) { // background-color: white !important; color: var(--o-button-color) !important; border-color: var(--o-button-border-color) !important; } -.el-button:not(.is-disabled):focus{ +.el-button:not(.is-disabled):focus { // background-color: white !important; - color:var(--o-button-color) !important; + color: var(--o-button-color) !important; border-color: var(--o-button-border-color) !important; } -.el-button:not(.is-disabled):active{ +.el-button:not(.is-disabled):active { // background-color: white !important; - color: #6395FD !important; - border-color: #6395FD !important; + color: #6395fd !important; + border-color: #6395fd !important; } -.el-button:not(.is-disabled):hover{ +.el-button:not(.is-disabled):hover { // background-color: white !important; - color: #7AA5FF !important; - border-color: #7AA5FF !important; + color: #7aa5ff !important; + border-color: #7aa5ff !important; } - - - -.el-button--primary:not(.is-disabled){ - background-color: #6395FD !important; +.el-button--primary:not(.is-disabled) { + background-color: #6395fd !important; color: white !important; - border-color: #6395FD !important; + border-color: #6395fd !important; } -.el-button--primary:not(.is-disabled):focus{ - background-color: #6395FD !important; +.el-button--primary:not(.is-disabled):focus { + background-color: #6395fd !important; color: white !important; - border-color: #6395FD !important; + border-color: #6395fd !important; } -.el-button--primary:not(.is-disabled):active{ - background-color: #6395FD !important; +.el-button--primary:not(.is-disabled):active { + background-color: #6395fd !important; color: white !important; - border-color: #6395FD !important; + border-color: #6395fd !important; } -.el-button--primary:not(.is-disabled):hover{ - background-color: #7AA5FF !important; +.el-button--primary:not(.is-disabled):hover { + background-color: #7aa5ff !important; color: white !important; - border-color: #7AA5FF !important; + border-color: #7aa5ff !important; } -.el-message{ - --o-message-border-radius:8px !important; +.el-message { + --o-message-border-radius: 8px !important; } -.exit-button{ +.exit-button { margin-left: 0px !important; } @@ -100,4 +96,4 @@ position: relative !important; top: unset !important; } -} \ No newline at end of file +} diff --git a/src/assets/styles/main.scss b/src/assets/styles/main.scss index e303235f640e44854e38bc80b1ccf81862473ca9..d570ceb1febc1291f3af9f1b2784a69a95fe71a2 100644 --- a/src/assets/styles/main.scss +++ b/src/assets/styles/main.scss @@ -1,3 +1,3 @@ @import './codePreview.scss'; @import './message.scss'; -@import './theme.scss' \ No newline at end of file +@import './theme.scss'; diff --git a/src/assets/styles/message.scss b/src/assets/styles/message.scss index 9874697ee866f69a74117cdad9bc8c8a5d692602..54a8670e99400e86d3ceeee0e5caac147347b21b 100644 --- a/src/assets/styles/message.scss +++ b/src/assets/styles/message.scss @@ -1,40 +1,38 @@ +.el-message { + width: 30%; + border-radius: 5px; +} -.el-message{ - width: 30%; - border-radius: 5px; - } - - .el-message--success{ - background-color: #C2E7C7; +.el-message--success { + background-color: #c2e7c7; + color: #000; + border-color: #24ab36; + border-radius: 10px; + .el-message__content { color: #000; - border-color: #24AB36; - border-radius: 10px; - .el-message__content{ - color: #000; - font-size: 12px; - - } + font-size: 12px; + } +} + +.el-message--warning { + background-color: #f9ecb8; + border-color: #ebaf00; + img { + width: 16px; + height: 16px; } - - .el-message--warning{ - background-color: #F9ECB8; - border-color: #EBAF00; - img{ - width: 16px; - height: 16px; - } - .el-message__content{ - color: #000; - font-size: 12px; - } + .el-message__content { + color: #000; + font-size: 12px; } - - .el-message--error{ - background-color: #F7C1C1; +} + +.el-message--error { + background-color: #f7c1c1; + color: #000; + border-color: #e42121; + .el-message__content { color: #000; - border-color: #E42121; - .el-message__content{ - color: #000; - font-size: 12px; - } - } \ No newline at end of file + font-size: 12px; + } +} diff --git a/src/assets/styles/theme.scss b/src/assets/styles/theme.scss index f800d6ae0aa34fa2e7e226c088f68a6d37431ab2..5748a4d123f90cf35b5ee9b5c08a6d2ef24ef230 100644 --- a/src/assets/styles/theme.scss +++ b/src/assets/styles/theme.scss @@ -11,38 +11,67 @@ body[theme='dark'] { --o-button-disable-border: #626d7c; --o-time-text: #3e4551; --o-bash-bg: #2a2f37; - --o-flow-code-bg: rgb(42,47,55); - --o-flow-code-border: rgb(62,69,81); + --o-flow-code-bg: rgb(42, 47, 55); + --o-flow-code-border: rgb(62, 69, 81); --flow-canvas-bg: rgb(24, 27, 32); - --flow-instance-hover-color: #1F2329; + --flow-instance-hover-color: #1f2329; --flow-instance-shadow: 0 4px 16px 0 rgba(253, 254, 255, 0.1); --flow-nodeBox-shadow: 0 8px 16px 0 rgba(253, 254, 255, 0.1); // 工作流节点背景色 --flow-bg-color: #343a43; - --o-bash-box-shadow: 0 4px 16px 0 rgba(255, 255, 255, 0.1); + --o-bash-box-shadow: 0 4px 16px 0 rgba(255, 255, 255, 0.1); // 工作流开始节点结束背景渐变色 - --flow-startEnd-bg: linear-gradient(rgba(132, 149, 253, 0.3), rgba(104, 113, 129, 0.15), rgba(52, 58, 67, 0)); - --flow-system-bg: linear-gradient(rgba(113, 225, 229, 0.3), rgba(97, 119, 121, 0.15), rgba(52, 58, 67, 0)); - --flow-apos-apollo-bg: linear-gradient(rgba(137, 212, 255, 0.3), rgba(103, 111, 130, 0.15), rgba(52, 58, 67, 0)); - --flow-euler-copilot-tune-bg: linear-gradient(rgba(156, 237, 203, 0.3), rgba(101, 125, 110, 0.15), rgba(52, 58, 67, 0)); - --flow-other-node-bg: linear-gradient(rgba(252, 154, 186, 0.3), rgba(117, 99, 110, 0.15), rgba(52, 58, 67, 0)); - --flow-node-default-over-color: #25303E; + --flow-startEnd-bg: linear-gradient( + rgba(132, 149, 253, 0.3), + rgba(104, 113, 129, 0.15), + rgba(52, 58, 67, 0) + ); + --flow-system-bg: linear-gradient( + rgba(113, 225, 229, 0.3), + rgba(97, 119, 121, 0.15), + rgba(52, 58, 67, 0) + ); + --flow-apos-apollo-bg: linear-gradient( + rgba(137, 212, 255, 0.3), + rgba(103, 111, 130, 0.15), + rgba(52, 58, 67, 0) + ); + --flow-euler-copilot-tune-bg: linear-gradient( + rgba(156, 237, 203, 0.3), + rgba(101, 125, 110, 0.15), + rgba(52, 58, 67, 0) + ); + --flow-other-node-bg: linear-gradient( + rgba(252, 154, 186, 0.3), + rgba(117, 99, 110, 0.15), + rgba(52, 58, 67, 0) + ); + --flow-node-default-over-color: #25303e; --flow-node-boder-default-over: #314265; - --flow-node-success-over-color: #1F312A; + --flow-node-success-over-color: #1f312a; --flow-node-error-over-color: #332127; --flow-branch-node-error-node-cover-color: #602c27; --flow-branch-node-success-node-cover-color: #295336; - --o-think-border:#8d98aa; - --o-think-header-bg:#2a2f37; - --o-think-header-text:#e4e8ee; - --el-drawer-bg-color:#000000; - --el-bg-color:#1F2329; - --question-bg: linear-gradient(0deg, rgb(47, 57, 66), rgb(32, 35, 37) 33.232%, rgb(41, 43, 55) 85.699%); - --el-collapse-header-bg: rgb(42,47,55); - --el-collapse-border: rgb(62,69,81,0.5); - --el-collapse-content-bg: rgb(42,47,55,0.5); - --applist-hover:#313741; - --flow-running-bg:linear-gradient(127.95deg, rgb(39, 39, 76) -1.967%, rgba(28, 57, 81, 0.929) 98.202%); + --o-think-border: #8d98aa; + --o-think-header-bg: #2a2f37; + --o-think-header-text: #e4e8ee; + --el-drawer-bg-color: #000000; + --el-bg-color: #1f2329; + --question-bg: linear-gradient( + 0deg, + rgb(47, 57, 66), + rgb(32, 35, 37) 33.232%, + rgb(41, 43, 55) 85.699% + ); + --el-collapse-header-bg: rgb(42, 47, 55); + --el-collapse-border: rgb(62, 69, 81, 0.5); + --el-collapse-content-bg: rgb(42, 47, 55, 0.5); + --applist-hover: #313741; + --flow-running-bg: linear-gradient( + 127.95deg, + rgb(39, 39, 76) -1.967%, + rgba(28, 57, 81, 0.929) 98.202% + ); } body[theme='light'] { @@ -58,36 +87,65 @@ body[theme='light'] { --o-button-disable-border: #ebedf3; --o-time-text: #dfe5ef; --o-bash-bg: #f4f6fa; - --o-flow-code-bg: rgb(244,256,258); - --o-flow-code-border: rgb(223,229,239); + --o-flow-code-bg: rgb(244, 256, 258); + --o-flow-code-border: rgb(223, 229, 239); --flow-canvas-bg: rgba(235, 239, 246); - --flow-instance-hover-color: #FDFEFF; + --flow-instance-hover-color: #fdfeff; --flow-instance-shadow: 0 4px 16px 0 rgba(0, 0, 0, 0.1); --flow-nodeBox-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.1); // 工作流节点背景色 --flow-bg-color: #fdfeff; - --o-bash-box-shadow: 0 4px 16px 0 rgba(42, 47, 55, 0.1); + --o-bash-box-shadow: 0 4px 16px 0 rgba(42, 47, 55, 0.1); // 工作流开始节点结束背景渐变色 - --flow-startEnd-bg: linear-gradient(rgba(133, 148, 253, 0.3), rgba(210, 231, 252, 0.15), rgba(255, 255, 255, 0)); - --flow-system-bg: linear-gradient(rgba(156, 237, 203, 0.3), rgba(240, 253, 244, 0.15), rgba(255, 255, 255, 0)); - --flow-apos-apollo-bg: linear-gradient(rgba(137, 212, 255, 0.3), rgba(230, 237, 255, 0.15), rgba(255, 255, 255, 0)); - --flow-euler-copilot-tune-bg: linear-gradient(rgba(156, 237, 203, 0.3), rgba(240, 253, 248, 0.15), rgba(255, 255, 255, 0)); - --flow-other-node-bg: linear-gradient(rgba(252, 154, 186, 0.3), rgba(253, 240, 248, 0.15), rgba(255, 255, 255, 0)); + --flow-startEnd-bg: linear-gradient( + rgba(133, 148, 253, 0.3), + rgba(210, 231, 252, 0.15), + rgba(255, 255, 255, 0) + ); + --flow-system-bg: linear-gradient( + rgba(156, 237, 203, 0.3), + rgba(240, 253, 244, 0.15), + rgba(255, 255, 255, 0) + ); + --flow-apos-apollo-bg: linear-gradient( + rgba(137, 212, 255, 0.3), + rgba(230, 237, 255, 0.15), + rgba(255, 255, 255, 0) + ); + --flow-euler-copilot-tune-bg: linear-gradient( + rgba(156, 237, 203, 0.3), + rgba(240, 253, 248, 0.15), + rgba(255, 255, 255, 0) + ); + --flow-other-node-bg: linear-gradient( + rgba(252, 154, 186, 0.3), + rgba(253, 240, 248, 0.15), + rgba(255, 255, 255, 0) + ); --flow-node-boder-default-over: #c7d6f5; --flow-node-success-over-color: #e6f6e9; --flow-node-error-over-color: #f8e7e7; - --o-think-border:#ccc; - --o-think-header-bg:#f8f8f8; - --o-think-header-text:#8d98aa; + --o-think-border: #ccc; + --o-think-header-bg: #f8f8f8; + --o-think-header-text: #8d98aa; --flow-branch-node-error-node-cover-color: #edb3b3; --flow-branch-node-success-node-cover-color: #b3dbb8; - --el-collapse-header-bg: rgb(244,246,250); - --el-collapse-border: rgb(223,229,239); - --el-collapse-content-bg: rgb(244,246,250,0.5); - --question-bg: linear-gradient(270deg, rgb(227, 242, 255), rgb(195, 227, 255) 33.232%, rgb(197, 203, 249) 85.699%); + --el-collapse-header-bg: rgb(244, 246, 250); + --el-collapse-border: rgb(223, 229, 239); + --el-collapse-content-bg: rgb(244, 246, 250, 0.5); + --question-bg: linear-gradient( + 270deg, + rgb(227, 242, 255), + rgb(195, 227, 255) 33.232%, + rgb(197, 203, 249) 85.699% + ); --question-shadow: rgba(221, 225, 240, 0.5); - --applist-hover:#f3f4f6; - --flow-running-bg:linear-gradient(127.95deg, rgba(109, 117, 250, 0.2) -1.967%, rgba(90, 179, 255, 0.2) 98.202%); + --applist-hover: #f3f4f6; + --flow-running-bg: linear-gradient( + 127.95deg, + rgba(109, 117, 250, 0.2) -1.967%, + rgba(90, 179, 255, 0.2) 98.202% + ); } body { @@ -98,4 +156,4 @@ body { .el-select-dropdown__item.is-selected { background-color: #6395fd !important; } -} \ No newline at end of file +} diff --git a/src/auto-imports.d.ts b/src/auto-imports.d.ts index 1d89ee8c4833d5972293125ae111ea45d41f2e83..fb10b91f058b463ca8a3e0b48465a59a9f49e077 100644 --- a/src/auto-imports.d.ts +++ b/src/auto-imports.d.ts @@ -4,6 +4,4 @@ // noinspection JSUnusedGlobalSymbols // Generated by unplugin-auto-import export {} -declare global { - -} +declare global {} diff --git a/src/bus/index.ts b/src/bus/index.ts index 0020e13cd319177b6d1618d55502639e1b53965c..3dbb7fda2b9d233753c7ed36903f2f9f64d4f836 100644 --- a/src/bus/index.ts +++ b/src/bus/index.ts @@ -1,4 +1,4 @@ // 引入mitt -import mitt from 'mitt' +import mitt from 'mitt'; const bus = mitt(); -export default bus; \ No newline at end of file +export default bus; diff --git a/src/components.d.ts b/src/components.d.ts index 3919a57d3ab685800884869e26bbeb4a10515de4..fec5155c61b8f394ddb536bb75e2018f188e470a 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -7,28 +7,28 @@ export {} declare module 'vue' { export interface GlobalComponents { - CommonFooter: typeof import('./components/commonFooter/CommonFooter.vue')['default'] - DialoguePanel: typeof import('./components/dialoguePanel/DialoguePanel.vue')['default'] - ElButton: typeof import('element-plus/es')['ElButton'] - ElCheckbox: typeof import('element-plus/es')['ElCheckbox'] - ElCheckboxGroup: typeof import('element-plus/es')['ElCheckboxGroup'] - ElDialog: typeof import('element-plus/es')['ElDialog'] - ElForm: typeof import('element-plus/es')['ElForm'] - ElFormItem: typeof import('element-plus/es')['ElFormItem'] - ElInput: typeof import('element-plus/es')['ElInput'] - ElPopover: typeof import('element-plus/es')['ElPopover'] - ElRadioButton: typeof import('element-plus/es')['ElRadioButton'] - ElRadioGroup: typeof import('element-plus/es')['ElRadioGroup'] - ElScrollbar: typeof import('element-plus/es')['ElScrollbar'] - ElTooltip: typeof import('element-plus/es')['ElTooltip'] - EulerDialog: typeof import('./components/EulerDialog.vue')['default'] - PrivacyText: typeof import('./components/commonFooter/PrivacyText.vue')['default'] - RouterLink: typeof import('vue-router')['RouterLink'] - RouterView: typeof import('vue-router')['RouterView'] - SessionCard: typeof import('./components/sessionCard/SessionCard.vue')['default'] - SvgIcon: typeof import('./components/SvgIcon.vue')['default'] + CommonFooter: (typeof import('./components/commonFooter/CommonFooter.vue'))['default']; + DialoguePanel: (typeof import('./components/dialoguePanel/DialoguePanel.vue'))['default']; + ElButton: (typeof import('element-plus/es'))['ElButton']; + ElCheckbox: (typeof import('element-plus/es'))['ElCheckbox']; + ElCheckboxGroup: (typeof import('element-plus/es'))['ElCheckboxGroup']; + ElDialog: (typeof import('element-plus/es'))['ElDialog']; + ElForm: (typeof import('element-plus/es'))['ElForm']; + ElFormItem: (typeof import('element-plus/es'))['ElFormItem']; + ElInput: (typeof import('element-plus/es'))['ElInput']; + ElPopover: (typeof import('element-plus/es'))['ElPopover']; + ElRadioButton: (typeof import('element-plus/es'))['ElRadioButton']; + ElRadioGroup: (typeof import('element-plus/es'))['ElRadioGroup']; + ElScrollbar: (typeof import('element-plus/es'))['ElScrollbar']; + ElTooltip: (typeof import('element-plus/es'))['ElTooltip']; + EulerDialog: (typeof import('./components/EulerDialog.vue'))['default']; + PrivacyText: (typeof import('./components/commonFooter/PrivacyText.vue'))['default']; + RouterLink: (typeof import('vue-router'))['RouterLink']; + RouterView: (typeof import('vue-router'))['RouterView']; + SessionCard: (typeof import('./components/sessionCard/SessionCard.vue'))['default']; + SvgIcon: (typeof import('./components/SvgIcon.vue'))['default']; } export interface ComponentCustomProperties { - vLoading: typeof import('element-plus/es')['ElLoadingDirective'] + vLoading: (typeof import('element-plus/es'))['ElLoadingDirective']; } } diff --git a/src/components/EulerDialog.vue b/src/components/EulerDialog.vue index 5852a4f1a883524af84075d2ec3b4e66144525e7..39d473654fcfc66238a0d51b5e9ae50e26307bdf 100644 --- a/src/components/EulerDialog.vue +++ b/src/components/EulerDialog.vue @@ -3,7 +3,7 @@ :model-value="visible" :show-close="false" width="50%" - :title="props.agreementName" + :title="props.agreementName" :close-on-press-escape="false" :close-on-click-modal="false" align-center @@ -14,7 +14,12 @@ @@ -45,7 +52,7 @@ const props = withDefaults( }>(), { needCheck: true, - } + }, ); const emits = defineEmits<{ @@ -88,7 +95,6 @@ const submitForm = async (formEl: FormInstance | undefined) => { diff --git a/src/components/Message.ts b/src/components/Message.ts index 56d318fda68d0645ae287e2c1b946eb9ad367a8a..13a8825a88002bd57be771a6996eda6deb82cd97 100644 --- a/src/components/Message.ts +++ b/src/components/Message.ts @@ -1,38 +1,37 @@ -import { ElMessage } from "element-plus"; +import { ElMessage } from 'element-plus'; -export const infoMsg = (msgInfo:string) => { - ElMessage({ - type:"info", - // showClose:true, - dangerouslyUseHTMLString:true, - message:msgInfo, - }) -} +export const infoMsg = (msgInfo: string) => { + ElMessage({ + type: 'info', + // showClose:true, + dangerouslyUseHTMLString: true, + message: msgInfo, + }); +}; -export const successMsg = (msgInfo:string) => { - ElMessage({ - // customClass:"el-message--success", - type:"success", - // showClose:true, - class:"el-message--success", - message:msgInfo, - }) -} -export const warningMsg = (msgInfo:string) => { - ElMessage({ - type:"warning", - // showClose:true, - class:"el-message--warning", - message:msgInfo, - }) -} - -export const errorMsg = (msgInfo:string) => { - ElMessage({ - type:"error", - // showClose:true, - class:"el-message--error", - message:msgInfo, - }) -} +export const successMsg = (msgInfo: string) => { + ElMessage({ + // customClass:"el-message--success", + type: 'success', + // showClose:true, + class: 'el-message--success', + message: msgInfo, + }); +}; +export const warningMsg = (msgInfo: string) => { + ElMessage({ + type: 'warning', + // showClose:true, + class: 'el-message--warning', + message: msgInfo, + }); +}; +export const errorMsg = (msgInfo: string) => { + ElMessage({ + type: 'error', + // showClose:true, + class: 'el-message--error', + message: msgInfo, + }); +}; diff --git a/src/components/SvgIcon.vue b/src/components/SvgIcon.vue index f83ae329ff94b701a0574bd673c6e18e09c3dbb1..d29161acb40948b38265542a8380549e037a45ed 100644 --- a/src/components/SvgIcon.vue +++ b/src/components/SvgIcon.vue @@ -44,7 +44,7 @@ withDefaults( { dir: 'right', fill: '#8D98AA', - } + }, ); + + + + diff --git a/src/components/commonFooter/CommonFooter.vue b/src/components/commonFooter/CommonFooter.vue index 47bc21a6c0d6fbc7e2891232567da6d5574201f7..5697da9f7811b3dc47067df625039c6e41975e56 100644 --- a/src/components/commonFooter/CommonFooter.vue +++ b/src/components/commonFooter/CommonFooter.vue @@ -14,14 +14,20 @@ const policy = ref(''); */ const readAgreement = async () => { const language = localStorage.getItem('localeLang'); - const response = language === 'en'?await import('src/conf/agreement-en.md?raw'):await import('src/conf/agreement.md?raw'); + const response = + language === 'en' + ? await import('src/conf/agreement-en.md?raw') + : await import('src/conf/agreement.md?raw'); agreement.value = marked.parse(response.default) as string; agreeDialogVisiable.value = true; }; -const readPolicy= async () => { +const readPolicy = async () => { const language = localStorage.getItem('localeLang'); - const response = language === 'en'?await import('src/conf/policy-en.md?raw'):await import('src/conf/policy.md?raw'); + const response = + language === 'en' + ? await import('src/conf/policy-en.md?raw') + : await import('src/conf/policy.md?raw'); policy.value = marked.parse(response.default) as string; policyDialogVisiable.value = true; }; @@ -29,10 +35,8 @@ const readPolicy= async () => { \ No newline at end of file + diff --git a/src/components/dialoguePanel/chartsCss.ts b/src/components/dialoguePanel/chartsCss.ts index 40691666341e772ff41496b124eb7bce826d9872..544dcf184ad43bfe13dba98a74449c2f798f3f98 100644 --- a/src/components/dialoguePanel/chartsCss.ts +++ b/src/components/dialoguePanel/chartsCss.ts @@ -1,42 +1,39 @@ export const Circlelegend = { - icon: "circle", - left: "24px", - top: "30%", - orient: "vertical", - padding: 24, - textStyle: { - fontSize: 12, - width: 200, - rich: { - oneone: { - fontSize: 16, - height: 30, - align: "right", - }, + icon: 'circle', + left: '24px', + top: '30%', + orient: 'vertical', + padding: 24, + textStyle: { + fontSize: 12, + width: 200, + rich: { + oneone: { + fontSize: 16, + height: 30, + align: 'right', }, }, - } + }, +}; export const Linetooltip = { - trigger: "axis", - formatter: function (params: any) { - var res = // 字符串形式的html标签会被echarts转换渲染成数据,这个res主要是画的tooltip里的上部分的标题部分 - "

" + - params[0].name; - ("

"); - for (var i = 0; i < params.length; i++) { - //因为是个数组,所以要遍历拿到里面的数据,并加入到tooltip的数据内容部分里面去 - res += `
+ trigger: 'axis', + formatter: function (params: any) { + var res = // 字符串形式的html标签会被echarts转换渲染成数据,这个res主要是画的tooltip里的上部分的标题部分 + "

" + + params[0].name; + ('

'); + for (var i = 0; i < params.length; i++) { + //因为是个数组,所以要遍历拿到里面的数据,并加入到tooltip的数据内容部分里面去 + res += `
${params[i].seriesName} ${params[i].data}
`; - } - return res; // 经过这么一加工,最终返回出去并渲染,最终就出现了我们所看的效果 - }, - } - - - + } + return res; // 经过这么一加工,最终返回出去并渲染,最终就出现了我们所看的效果 + }, +}; diff --git a/src/components/dialoguePanel/data.ts b/src/components/dialoguePanel/data.ts index 95409242dd21aa9db644088e63b43536da508df2..a2bd0ca1cc86b3a9f4a822c4f687b25d8bb4d5b2 100644 --- a/src/components/dialoguePanel/data.ts +++ b/src/components/dialoguePanel/data.ts @@ -1,49 +1,47 @@ export const input = { - "event": "flow.start", - "id": "0f9d3e6b-7845-44ab-b247-35c522d38f13", - "groupId": "09125776-ba69-4832-86c9-c5035f9343fd", - "conversationId": "eccb08c3-0621-4602-a4d2-4eaada892557", - "task_id": "eb717bc7-3435-4172-82d1-6b69e62f3fd6", - "flow": { - "appId": "aops-cve", - "flowId": "query_cve_info", - "step_name": "开始", - "step_status": "finished", - "step_progress": "1/4" - }, - "content": { - "question": "openEuler社区版本有哪些分类?", - "params": { - } - }, - "measure": { - "input_tokens": 200, - "output_tokens": 50, - "time": 0.5 - } -} + event: 'flow.start', + id: '0f9d3e6b-7845-44ab-b247-35c522d38f13', + groupId: '09125776-ba69-4832-86c9-c5035f9343fd', + conversationId: 'eccb08c3-0621-4602-a4d2-4eaada892557', + task_id: 'eb717bc7-3435-4172-82d1-6b69e62f3fd6', + flow: { + appId: 'aops-cve', + flowId: 'query_cve_info', + step_name: '开始', + step_status: 'finished', + step_progress: '1/4', + }, + content: { + question: 'openEuler社区版本有哪些分类?', + params: {}, + }, + measure: { + input_tokens: 200, + output_tokens: 50, + time: 0.5, + }, +}; export const output = { - "event": "flow.stop", - "id": "0f9d3e6b-7845-44ab-b247-35c522d38f13", - "groupId": "09125776-ba69-4832-86c9-c5035f9343fd", - "conversationId": "eccb08c3-0621-4602-a4d2-4eaada892557", - "task_id": "eb717bc7-3435-4172-82d1-6b69e62f3fd6", - "flow": { - "appId": "aops-cve", - "flowId": "query_cve_info", - "step_name": "开始", - "step_status": "finished", - "step_progress": "1/4" - }, - "content": { - "question": "查询所有主机的CVE信息", - "params": { - } - }, - "measure": { - "input_tokens": 200, - "output_tokens": 50, - "time": 0.5 - } -} \ No newline at end of file + event: 'flow.stop', + id: '0f9d3e6b-7845-44ab-b247-35c522d38f13', + groupId: '09125776-ba69-4832-86c9-c5035f9343fd', + conversationId: 'eccb08c3-0621-4602-a4d2-4eaada892557', + task_id: 'eb717bc7-3435-4172-82d1-6b69e62f3fd6', + flow: { + appId: 'aops-cve', + flowId: 'query_cve_info', + step_name: '开始', + step_status: 'finished', + step_progress: '1/4', + }, + content: { + question: '查询所有主机的CVE信息', + params: {}, + }, + measure: { + input_tokens: 200, + output_tokens: 50, + time: 0.5, + }, +}; diff --git a/src/components/sessionCard/SessionCard.vue b/src/components/sessionCard/SessionCard.vue index 9a6e06bd35caa817943ba60baadfb125c130598f..906f960049c02aa645f1b5b214b09c05195d0c43 100644 --- a/src/components/sessionCard/SessionCard.vue +++ b/src/components/sessionCard/SessionCard.vue @@ -1,6 +1,10 @@ diff --git a/src/views/app/index.vue b/src/views/app/index.vue index 01dd21960a1944c2c68eccd9fd48c68b3211ad3b..ddc76e836abc98f5a914f92142b174d523302ccb 100644 --- a/src/views/app/index.vue +++ b/src/views/app/index.vue @@ -4,35 +4,53 @@
{{ $t('app.app_center') }}
- + - {{$t('app.app_create')}} + + {{ $t('app.app_create') }} +
-
- {{$t('app.all_app')}} +
+ {{ $t('app.all_app') }}
- {{$t('app.my_created')}} + {{ $t('app.my_created') }}
- {{$t('app.my_favorite')}} + {{ $t('app.my_favorite') }}
@@ -51,13 +69,22 @@
-
{{ appItem.name }}
+
+ {{ appItem.name }} +
- +
@@ -68,12 +95,22 @@
@{{ appItem.author }}
-
- {{$t('app.app_edit')}} - {{$t('app.app_delete')}} +
+ + {{ $t('app.app_edit') }} + + + {{ $t('app.app_delete') }} +
-
+
{{ $t('app.unpublished') }}
@@ -81,7 +118,7 @@
-
{{$t('app.no_data')}}
+
{{ $t('app.no_data') }}
import TextMoreTootip from '@/components/textMoreTootip/index.vue'; -import { IconCaretDown, IconSearch, IconFavorite, IconUnfavorite, IconSuccess } from '@computing/opendesign-icons'; +import { + IconCaretDown, + IconSearch, + IconFavorite, + IconUnfavorite, + IconSuccess, +} from '@computing/opendesign-icons'; import './style.scss'; import { ref, onMounted, watch, markRaw } from 'vue'; import { useRouter } from 'vue-router'; import { api } from 'src/apis'; import { ElMessage, ElMessageBox } from 'element-plus'; import { IconAlarm } from '@computing/opendesign-icons'; -import RobotIcon from '../../assets/svgs/robot_icon.svg' +import RobotIcon from '../../assets/svgs/robot_icon.svg'; import { storeToRefs } from 'pinia'; import { useAccountStore, useHistorySessionStore } from 'src/store'; import CustomLoading from '../customLoading/index.vue'; @@ -134,8 +177,8 @@ const handleChangePage = (pageNum: number, pageSize: number) => { }; const getImgBg = (appItem) => { - return appItem.icon || RobotIcon; -} + return appItem.icon || RobotIcon; +}; const handleCreateApp = () => { api @@ -143,14 +186,14 @@ const handleCreateApp = () => { name: '默认应用', description: '我的应用', }) - .then(res => { + .then((res) => { if (res[1]) { router.push(`/createApp?appId=${res?.[1]?.result.appId}`); } }); }; -const routerToDetail = appItem => { +const routerToDetail = (appItem) => { if (!appItem.published) { //未发布应用不允许跳转 return; @@ -182,7 +225,7 @@ const handleQueryAppList = (payload?: any) => { pageSize: currentPageSize.value, ...payload, }) - .then(res => { + .then((res) => { appList.value = res[1]?.result.applications; currentPage.value = res[1]?.result.currentPage; totalCount.value = res[1]?.result.totalApps; @@ -201,12 +244,12 @@ const handleFavorite = (e, item) => { id: item.appId, favorited: !item.favorited, }) - .then(res => { + .then((res) => { handleParmasQueryAppList(); }); }; -const handleSearchAppList = type => { +const handleSearchAppList = (type) => { appType.value = type; if (type === 'my') { handleParmasQueryAppList(); @@ -229,7 +272,7 @@ const handleDelApp = (e, item) => { .deleteSingleAppData({ id: item.appId, }) - .then(res => { + .then((res) => { if (res[1]) { ElMessage({ showClose: true, @@ -262,7 +305,7 @@ onMounted(() => { }); diff --git a/src/views/createapp/components/workFlowConfig/useDnD.js b/src/views/createapp/components/workFlowConfig/useDnD.js index a7733d6ca2f19bb5c43caadf507c5d534c593f8d..eecea56426ec7da0bf145167a44c52b5f3b28ea8 100644 --- a/src/views/createapp/components/workFlowConfig/useDnD.js +++ b/src/views/createapp/components/workFlowConfig/useDnD.js @@ -26,9 +26,15 @@ const state = { export default function useDragAndDrop() { const { draggedType, isDragOver, isDragging, nodeData } = state; - const { addNodes, screenToFlowCoordinate, onNodesInitialized, updateNode, addEdges } = useVueFlow(); - - watch(isDragging, dragging => { + const { + addNodes, + screenToFlowCoordinate, + onNodesInitialized, + updateNode, + addEdges, + } = useVueFlow(); + + watch(isDragging, (dragging) => { document.body.style.userSelect = dragging ? 'none' : ''; }); @@ -100,7 +106,7 @@ export default function useDragAndDrop() { */ const { off } = onNodesInitialized(() => { const vueFlowContainer = document.querySelector('.my-diagram-class'); - updateNode(nodeId, node => ({ + updateNode(nodeId, (node) => ({ position: { x: node.position.x - node.dimensions.width / 2, y: node.position.y - node.dimensions.height / 2, diff --git a/src/views/createapp/components/workFlowConfig/useLayout.js b/src/views/createapp/components/workFlowConfig/useLayout.js index 5ae8340cbb350e20574d09b6a969028f2cc5cf04..cb817bb44bc42bec6382b3e6e72c47271a605fac 100644 --- a/src/views/createapp/components/workFlowConfig/useLayout.js +++ b/src/views/createapp/components/workFlowConfig/useLayout.js @@ -34,7 +34,10 @@ export function useLayout() { // 查找到节点的信息 const graphNode = findNode(node.id); // 获取到所有节点中最高的高度,之后可计算每个节点与最高高度差设置y,使得节点的中心点都在同一水平线上 - maxHeight = maxHeight > graphNode.dimensions.height ? maxHeight : graphNode.dimensions.height; + maxHeight = + maxHeight > graphNode.dimensions.height + ? maxHeight + : graphNode.dimensions.height; } for (const node of nodes) { @@ -57,13 +60,19 @@ export function useLayout() { dagre.layout(dagreGraph); // set nodes with updated positions - return nodes.map(node => { + return nodes.map((node) => { const nodeWithPosition = dagreGraph.node(node.id); let diff = maxHeight - nodeWithPosition.height; - let position = { x: nodeWithPosition.x, y: nodeWithPosition.y + diff / 2 }; + let position = { + x: nodeWithPosition.x, + y: nodeWithPosition.y + diff / 2, + }; // 需要进行判断--是否为开始结束 if (node.id === 'start' || node.id === 'end') { - position = { x: nodeWithPosition.x + 112, y: nodeWithPosition.y + diff / 2 }; + position = { + x: nodeWithPosition.x + 112, + y: nodeWithPosition.y + diff / 2, + }; } return { diff --git a/src/views/createapp/components/workFlowConfig/workFlowDialog.vue b/src/views/createapp/components/workFlowConfig/workFlowDialog.vue index 5f9097c703ffced9b1d7e7eeeff14313b01147d2..4d25652c00cf6262907781827a0f6ff43c89c46a 100644 --- a/src/views/createapp/components/workFlowConfig/workFlowDialog.vue +++ b/src/views/createapp/components/workFlowConfig/workFlowDialog.vue @@ -1,5 +1,10 @@