Initial commit: Copilot Toolbox template project

This commit is contained in:
Evan
2026-01-09 10:49:51 +08:00
commit 0b4b053566
31 changed files with 12085 additions and 0 deletions

28
src/api/common.ts Normal file
View File

@@ -0,0 +1,28 @@
import { cacheGet } from '@/utils/cacheUtil'
export function getAgentBaseInfo(params: { id: string }) {
const Tenantid = cacheGet('tenantId')
const Token = cacheGet('token')
return fetch(`${import.meta.env.VITE_API_BASE_AI}/agent/baseInfo/info?id=${params.id}`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Tenantid,
Token
}
}).then(res => res.json())
}
// 获取用户信息
export async function getUserInfoById() {
const Tenantid = cacheGet('tenantId')
const Token = cacheGet('token')
return fetch(`${import.meta.env['VITE_API_BASE_LAMP']}/oauth/anyone/getUserInfoById`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
Tenantid,
Token
}
}).then(res => res.json())
}

View File

@@ -0,0 +1,34 @@
export interface TranslationRequest {
source_content: string
}
export interface DifyRequest {
inputs: {
prompt: string
}
query: string
response_mode: string
}
export function translateChineseToEnglish(source_content: string) {
const prompt = `你是一个专业的中英翻译专家。请将下面的中文文本翻译成自然、地道、专业的英文,只返回翻译后的英文内容,不要添加任何额外的解释或格式。待翻译的中文内容是:
${source_content}`
const requestBody: DifyRequest = {
inputs: {
prompt
},
query: '1',
response_mode: 'streaming'
}
return fetch('https://copilot.sino-bridge.com/v1/chat-messages', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer app-Y6ekYkw3aoUV3jmfZdg24Adh'
},
body: JSON.stringify(requestBody)
})
}