Merge #5 into develop_web from feature/20251219_zy
optimize: check en.ts * feature/20251219_zy: (6 commits) optimize: UI update components: Add Chat component optimize: 1. stream request optimize; 2. replace Chat component feature: memory extraction engine debug switch to streaming output feature: add api key optimize: check en.ts Signed-off-by: zhaoying <zhaoying@redbearai.com> Merged-by: zhaoying <zhaoying@redbearai.com> CR-link: https://codeup.aliyun.com/redbearai/python/redbear-mem-open/change/5
This commit is contained in:
33
web/src/api/apiKey.ts
Normal file
33
web/src/api/apiKey.ts
Normal file
@@ -0,0 +1,33 @@
|
||||
import { request } from '@/utils/request'
|
||||
import type { ApiKey } from '@/views/ApiKeyManagement/types'
|
||||
|
||||
// API Key列表
|
||||
export const getApiKeyListUrl = '/apikeys'
|
||||
export const getApiKeyList = (data: Record<string, unknown>) => {
|
||||
return request.get(getApiKeyListUrl, data)
|
||||
}
|
||||
|
||||
// API Key详情
|
||||
export const getApiKey = (id: string) => {
|
||||
return request.get(`/apikeys/${id}`)
|
||||
}
|
||||
|
||||
// 创建API Key
|
||||
export const createApiKey = (values: ApiKey) => {
|
||||
return request.post('/apikeys', values)
|
||||
}
|
||||
|
||||
// 更新API Key
|
||||
export const updateApiKey = (id: string, values: ApiKey) => {
|
||||
return request.put(`/apikeys/${id}`, values)
|
||||
}
|
||||
|
||||
// 删除 API Key
|
||||
export const deleteApiKey = (id: string) => {
|
||||
return request.delete(`/apikeys/${id}`)
|
||||
}
|
||||
|
||||
// 使用统计
|
||||
export const getApiKeyStats = (app_key_id: string) => {
|
||||
return request.get(`/apikeys/${app_key_id}/stats`)
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
import { request } from '@/utils/request'
|
||||
import type { Application } from '@/views/ApplicationManagement/types'
|
||||
import type { Config } from '@/views/ApplicationConfig/types'
|
||||
import { handleSSE } from '@/utils/stream'
|
||||
import { handleSSE, type SSEMessage } from '@/utils/stream'
|
||||
import type { QueryParams } from '@/views/Conversation/types'
|
||||
|
||||
// 应用列表
|
||||
export const getApplicationListUrl = '/apps'
|
||||
@@ -37,10 +38,10 @@ export const saveMultiAgentConfig = (app_id: string, values: Config) => {
|
||||
return request.put(`/apps/${app_id}/multi-agent`, values)
|
||||
}
|
||||
// 模型比对试运行
|
||||
export const runCompare = (app_id: string, values: Record<string, unknown>, onMessage?: (data: string) => void) => {
|
||||
export const runCompare = (app_id: string, values: Record<string, unknown>, onMessage?: (data: SSEMessage[]) => void) => {
|
||||
return handleSSE(`/apps/${app_id}/draft/run/compare`, values, onMessage)
|
||||
}
|
||||
export const draftRun = (app_id: string, values: Record<string, unknown>, onMessage?: (data: string) => void) => {
|
||||
export const draftRun = (app_id: string, values: Record<string, unknown>, onMessage?: (data: SSEMessage[]) => void) => {
|
||||
return handleSSE(`/apps/${app_id}/draft/run`, values, onMessage)
|
||||
}
|
||||
// 删除应用
|
||||
@@ -76,18 +77,7 @@ export const getConversationHistory = (share_token: string, data: { page: number
|
||||
})
|
||||
}
|
||||
// 发送体验对话
|
||||
export const sendConversation = (share_token: string, values: {
|
||||
message: string;
|
||||
web_search: boolean;
|
||||
memory: boolean;
|
||||
stream: boolean;
|
||||
conversation_id: string | null;
|
||||
}, onMessage, shareToken: string) => {
|
||||
// return request.post(`/public/share/chat`, values, {
|
||||
// headers: {
|
||||
// 'Authorization': `Bearer ${localStorage.getItem(`shareToken_${share_token}`)}`
|
||||
// }
|
||||
// })
|
||||
export const sendConversation = (values: QueryParams, onMessage: (data: SSEMessage[]) => void, shareToken: string) => {
|
||||
return handleSSE(`/public/share/chat`, values, onMessage, {
|
||||
headers: {
|
||||
'Authorization': `Bearer ${shareToken}`
|
||||
|
||||
@@ -9,6 +9,7 @@ import type {
|
||||
ConfigForm as ExtractionConfigForm
|
||||
} from '@/views/MemoryExtractionEngine/types'
|
||||
import type { TestParams } from '@/views/MemoryConversation'
|
||||
import { handleSSE, type SSEMessage } from '@/utils/stream'
|
||||
|
||||
// 记忆对话
|
||||
export const readService = (query: TestParams) => {
|
||||
@@ -132,8 +133,8 @@ export const updateMemoryExtractionConfig = (values: ExtractionConfigForm) => {
|
||||
return request.post('/memory-storage/update_config_extracted', values)
|
||||
}
|
||||
// 记忆萃取引擎-试运行
|
||||
export const pilotRunMemoryExtractionConfig = (values: { config_id: number | string; dialogue_text: string }) => {
|
||||
return request.post('/memory-storage/pilot_run', values)
|
||||
export const pilotRunMemoryExtractionConfig = (values: { config_id: number | string; dialogue_text: string; }, onMessage?: (data: SSEMessage[]) => void) => {
|
||||
return handleSSE('/memory-storage/pilot_run', values, onMessage)
|
||||
}
|
||||
/*************** end 记忆管理 相关接口 ******************************/
|
||||
|
||||
|
||||
Reference in New Issue
Block a user