feat(weknoracloud): implement credential management and status checks
- Introduced a new WeKnoraCloudSettings component for managing APPID and APPSECRET. - Added functionality to save WeKnoraCloud credentials without automatically creating models. - Implemented credential status checks across various components to provide user feedback on configuration status. - Updated API endpoints to handle credential saving and status retrieval. - Enhanced UI elements to guide users in configuring WeKnoraCloud settings. This update improves the integration of WeKnoraCloud by allowing users to manage their credentials more effectively and receive real-time feedback on their configuration status.
This commit is contained in:
@@ -131,16 +131,22 @@ export interface InitializeWeKnoraCloudRequest {
|
||||
app_secret: string
|
||||
}
|
||||
|
||||
export interface InitializeWeKnoraCloudResult {
|
||||
models: Array<{
|
||||
name: string
|
||||
type: string
|
||||
action: 'created' | 'updated'
|
||||
}>
|
||||
}
|
||||
|
||||
export function initializeWeKnoraCloud(data: InitializeWeKnoraCloudRequest): Promise<InitializeWeKnoraCloudResult> {
|
||||
return post('/api/v1/models/weknoracloud/initialize', data) as Promise<InitializeWeKnoraCloudResult>
|
||||
// 仅保存 WeKnoraCloud 凭证,不自动创建模型
|
||||
export function saveWeKnoraCloudCredentials(data: InitializeWeKnoraCloudRequest): Promise<{ success: boolean; message: string }> {
|
||||
return new Promise((resolve, reject) => {
|
||||
post('/api/v1/weknoracloud/credentials', data)
|
||||
.then((response: any) => {
|
||||
if (response.success) {
|
||||
resolve(response)
|
||||
} else {
|
||||
reject(new Error(response.message || response.error || '凭证保存失败'))
|
||||
}
|
||||
})
|
||||
.catch((error: any) => {
|
||||
console.error('Failed to save WeKnoraCloud credentials:', error)
|
||||
reject(error)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
export interface WeKnoraCloudStatusResult {
|
||||
|
||||
Reference in New Issue
Block a user