Commit a5bb29b3 authored by nick zheng's avatar nick zheng

Merge branch 'beta' into 'master'

chore: 应用API配置重新生成及跳转接口文档

See merge request !136
parents d80a25f3 af23eba2
...@@ -194,3 +194,10 @@ export function fetchUpdateAutoPlay<T>(agentId: string, autoPlay: 'Y' | 'N') { ...@@ -194,3 +194,10 @@ export function fetchUpdateAutoPlay<T>(agentId: string, autoPlay: 'Y' | 'N') {
export function fetchGetAPIProfile<T>() { export function fetchGetAPIProfile<T>() {
return request.post<T>('/agentApplicationRest/getApiProfile.json') return request.post<T>('/agentApplicationRest/getApiProfile.json')
} }
/**
* @returns 重新生成API配置
*/
export function fetchResetAPIProfile<T>() {
return request.post<T>('/agentApplicationRest/resetApiProfile.json')
}
...@@ -5,7 +5,7 @@ import { createApiCallDetailColumns } from '../columns' ...@@ -5,7 +5,7 @@ import { createApiCallDetailColumns } from '../columns'
import { ApiCallDetailItem, ApiProfileInfo } from '../type' import { ApiCallDetailItem, ApiProfileInfo } from '../type'
import { usePersonalAppConfigStore } from '@/store/modules/personal-app-config' import { usePersonalAppConfigStore } from '@/store/modules/personal-app-config'
import { copyToClip } from '@/utils/copy' import { copyToClip } from '@/utils/copy'
import { fetchGetAPIProfile } from '@/apis/agent-application' import { fetchGetAPIProfile, fetchResetAPIProfile } from '@/apis/agent-application'
import { fetchGetAPIChannelPointUsageCount, fetchReportAPIChannelPointUsage } from '@/apis/agent-analyze' import { fetchGetAPIChannelPointUsageCount, fetchReportAPIChannelPointUsage } from '@/apis/agent-analyze'
enum RangType { enum RangType {
...@@ -72,6 +72,13 @@ watch( ...@@ -72,6 +72,13 @@ watch(
}, },
) )
function handleTurnToInterfaceDocument() {
window.open(
'https://www.yuque.com/u21309325/qlruxb/vp47nefvokd23d58?singleDoc#%20%E3%80%8Amodel-link%20api%E6%96%87%E6%A1%A3%E3%80%8B',
'_blank',
)
}
async function handleGetAPIProfile() { async function handleGetAPIProfile() {
apiProfileLoading.value = true apiProfileLoading.value = true
...@@ -83,6 +90,17 @@ async function handleGetAPIProfile() { ...@@ -83,6 +90,17 @@ async function handleGetAPIProfile() {
} }
} }
async function handleResetAPIProfile() {
apiProfileLoading.value = true
const res = await fetchResetAPIProfile<ApiProfileInfo>()
if (res.code === 0) {
apiProfileInfo.value = res.data
apiProfileLoading.value = false
}
}
async function handleGetAPIChannelPointUsageCount() { async function handleGetAPIChannelPointUsageCount() {
apiCallDetailLoading.value = true apiCallDetailLoading.value = true
...@@ -171,7 +189,7 @@ async function handleExportAPIChannelPointUsageData() { ...@@ -171,7 +189,7 @@ async function handleExportAPIChannelPointUsageData() {
> >
<div class="flex min-h-[calc(100vh-56px-62px-20px)] flex-col rounded-[10px] bg-[#fafbfc] p-5"> <div class="flex min-h-[calc(100vh-56px-62px-20px)] flex-col rounded-[10px] bg-[#fafbfc] p-5">
<div class="mb-5 flex justify-end pr-5"> <div class="mb-5 flex justify-end pr-5">
<n-button type="primary" :bordered="false"> <n-button type="primary" :bordered="false" @click="handleTurnToInterfaceDocument">
{{ t('personal_space_module.agent_module.agent_setting_module.agent_publish_module.interface_document') }} {{ t('personal_space_module.agent_module.agent_setting_module.agent_publish_module.interface_document') }}
</n-button> </n-button>
</div> </div>
...@@ -179,15 +197,22 @@ async function handleExportAPIChannelPointUsageData() { ...@@ -179,15 +197,22 @@ async function handleExportAPIChannelPointUsageData() {
<div class="rounded-[10px] border border-[#e7e7e7] bg-white p-5"> <div class="rounded-[10px] border border-[#e7e7e7] bg-white p-5">
<div class="mb-[7px] flex items-center justify-between"> <div class="mb-[7px] flex items-center justify-between">
<p class="font-600">App Key</p> <p class="font-600">App Key</p>
<span class="text-theme-color cursor-pointer hover:opacity-80" @click="handleGetAPIProfile"> <span
v-show="!apiProfileInfo.apiKey"
class="text-theme-color cursor-pointer hover:opacity-80"
@click="handleGetAPIProfile"
>
{{ {{
apiProfileInfo.apiKey t('personal_space_module.agent_module.agent_setting_module.agent_publish_module.click_to_generate')
? t('common_module.regenerate')
: t(
'personal_space_module.agent_module.agent_setting_module.agent_publish_module.click_to_generate',
)
}} }}
</span> </span>
<span
v-show="apiProfileInfo.apiKey"
class="text-theme-color cursor-pointer hover:opacity-80"
@click="handleResetAPIProfile"
>
{{ t('common_module.regenerate') }}
</span>
</div> </div>
<div class="rounded-theme h-9 w-full cursor-default border px-3"> <div class="rounded-theme h-9 w-full cursor-default border px-3">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment