diff --git a/src/apis/paths/api.ts b/src/apis/paths/api.ts index 18d1d8d047007e6af6c13a0ca87bc39807e598fa..b274e528d0b2375ced1469cd52efc3946e99e875 100644 --- a/src/apis/paths/api.ts +++ b/src/apis/paths/api.ts @@ -1,164 +1,59 @@ // Copyright (c) Huawei Technologies Co., Ltd. 2023-2024. All rights reserved. -// licensed under the Mulan PSL v2. -// You can use this software according to the terms and conditions of the Mulan PSL v2. -// You may obtain a copy of Mulan PSL v2 at: -// http://license.coscl.org.cn/MulanPSL2 -// THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR -// PURPOSE. -// See the Mulan PSL v2 for more details. -import { get, post, del, put } from 'src/apis/server'; +import { post, get, del, put } from 'src/apis/server'; import type { FcResponse } from 'src/apis/server'; -import { ApiMessage, Service } from './type'; - +import { QueryApiListParamsType, CreateOrUpdateApiParamsType } from './type'; /** - * 查询服务下接口信息 + * 获取语义接口列表 + * @param params * @returns */ -export const getApiMessageByServiceId = ( - serviceId: string, - page: number, - pageSize: number, -): Promise< - [ - any, - ( - | FcResponse<{ - serviceId: string; - name: string; - apis: ApiMessage[]; - }> - | undefined - ) - ] -> => { - return get(`/api/service/${serviceId}/key`,{page, pageSize}); +// 导出一个函数queryApiList,用于查询API列表 +export const queryApiList = (params: QueryApiListParamsType): Promise<[any, FcResponse | undefined]> => { + // 调用get函数,传入/api/service路径和params参数,返回一个Promise对象 + return get('/api/service', params); }; /** - * 查询语义服务列表 + * 创建语义接口/更新语义接口 + * @param params * @returns */ -export const getApiMessageList = (params: { - createdByMe?: string; - favorited?: string; - searchType?: string; - keyword?: string; - page?: number; - pageSize?: number; -} - ): Promise< - [ - any, - ( - | FcResponse<{ - services: Service[]; - }> - | undefined - ) - ] - > => { - return get('/api/auth/key',{ - ...params - }); - }; +export const createOrUpdateApi = ( + params: CreateOrUpdateApiParamsType, +): Promise<[any, FcResponse | undefined]> => { + return post('/api/service', params); +}; /** - * 通过上传 YAML 文本创建/编辑服务 + * 获取指定语义接口数据 + * @param params * @returns */ -export const uploadYAML = (params: { - serviceId?: string; - yaml: string; - } - ): Promise< - [ - any, - ( - | FcResponse<{ - serviceId: string; - name: string; - apis: ApiMessage[]; - }> - | undefined - ) - ] - > => { - return post('/api/service',{ - ...params - }); - }; +export const querySingleApiData = (params: { serviceId: string }): Promise<[any, FcResponse | undefined]> => { + return get(`/api/service/${params.serviceId}`); +}; /** - * 获取指定服务的详细信息及 YAML 内容 + * 删除语义接口 + * @param params * @returns */ -export const getYAMLByServiceId = (params: { - serviceId: string; - } - ): Promise< - [ - any, - ( - | FcResponse<{ - serviceId: string; - name: string; - yaml: string; - }> - | undefined - ) - ] - > => { - return get(`/api/service/${params.serviceId}`) - }; +export const deleteSingleApiData = (params: { serviceId: string }): Promise<[any, FcResponse | undefined]> => { + return del(`/api/service/${params.serviceId}`, params); +}; /** - * 删除指定服务 - * @returns - */ -export const deleteYAMLByServiceId = (params: { - serviceId: string; - } - ): Promise< - [ - any, - ( - | FcResponse<{ - serviceId: string; - }> - | undefined - ) - ] - > => { - return del(`/api/service/${params.serviceId}`); - }; - -/** - * 更改服务收藏状态 + * 更改语义接口收藏状态 + * @param params * @returns */ -export const likeServiceByServiceId = (params: { - serviceId: string; - } - ): Promise< - [ - any, - ( - | FcResponse<{ - serviceId: string; - }> - | undefined - ) - ] - > => { - return put(`/api/service/${params.serviceId}`); - }; - -export const apiApi = { - getApiMessageByServiceId, - getApiMessageList, - uploadYAML, - getYAMLByServiceId, - deleteYAMLByServiceId, - likeServiceByServiceId, +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 diff --git a/src/apis/paths/type.ts b/src/apis/paths/type.ts index 3fbfbb6284796cacb530ae7973035379007625b1..3659c300d9361a427daff433f43842bbfe1e3998 100644 --- a/src/apis/paths/type.ts +++ b/src/apis/paths/type.ts @@ -76,7 +76,7 @@ export interface Suggest { export interface ConversationListItem { conversationId: string, createdTime: string, - doc_count: number, + docCount: number, title: string, } @@ -88,7 +88,7 @@ export interface ConversationList { } /* - * 应用数据结构 + * 语义接口数据结构 */ export interface Application { appId: string, @@ -96,7 +96,7 @@ export interface Application { } /* - * 语意接口数据结构 + * 语义接口数据结构 */ export interface ApiMessage { apiId: string, @@ -107,7 +107,7 @@ export interface ApiMessage { } /* - * 语意接口数据结构 + * 语义接口数据结构 */ export interface Service { serviceId: string, @@ -116,4 +116,60 @@ export interface Service { author: string, description: string, favorite: boolean, -} \ No newline at end of file +} + +export interface QueryApiListParamsType { + /** + * 筛选“我创建的”语义接口 + */ + 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", +} + +/** + * CreateAppRequest, 创建/更新语义接口请求数据结构 + */ +export interface CreateOrUpdateApiParamsType { + /** + * 语义接口ID + */ + serviceId?: string; + /** + * 语义接口yaml 文件(json 格式) + */ + data?: string; + /** + * 对话轮次(1~10) + */ + [property: string]: any; +} diff --git a/src/apis/tools.ts b/src/apis/tools.ts index 45a361af42801bb615df909208461d51dcbf1bee..2e51c733c75e34e100e4f148011652e8e46a4a72 100644 --- a/src/apis/tools.ts +++ b/src/apis/tools.ts @@ -76,7 +76,7 @@ export const handleAuthorize = async (errStatus: number): Promise => { window.open(LOGOUT_CALLBACK_URL, '_self'); } else{ - errorMsg(`${errStatus} is error`); + // errorMsg(`${errStatus} is error`); } }; diff --git a/src/assets/styles/theme.scss b/src/assets/styles/theme.scss index 6d8b29e111cfea48695ae91c16db829c1b613e6b..3156f92477133568703e345adb5f8b26f2ef30bb 100644 --- a/src/assets/styles/theme.scss +++ b/src/assets/styles/theme.scss @@ -22,6 +22,9 @@ body[theme='dark'] { --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; } body[theme='light'] { @@ -46,6 +49,9 @@ body[theme='light'] { --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; --flow-branch-node-error-node-cover-color: #edb3b3; --flow-branch-node-success-node-cover-color: #b3dbb8; } diff --git a/src/components/Upload/index.vue b/src/components/Upload/index.vue new file mode 100644 index 0000000000000000000000000000000000000000..90accc465d3ed421a510a0b2fca61bd8fb898f27 --- /dev/null +++ b/src/components/Upload/index.vue @@ -0,0 +1,328 @@ + + + + diff --git a/src/components/dialoguePanel/DialogueThought.vue b/src/components/dialoguePanel/DialogueThought.vue index 9c2b174fb46c6c8c2378fafd9da6d6d73ed4dcd6..12b3a6749a511823c3d072f53fde8d674bae3a7b 100644 --- a/src/components/dialoguePanel/DialogueThought.vue +++ b/src/components/dialoguePanel/DialogueThought.vue @@ -4,7 +4,9 @@
- + + +
思考
@@ -16,6 +18,7 @@ -