mirror of
https://github.com/1Panel-dev/1Panel.git
synced 2026-11-17 00:06:00 +00:00
fix(ai): persist model service verification status (#14450)
This commit is contained in:
@@ -420,7 +420,7 @@ type AgentAccountInfo struct {
|
||||
VerifyModel string `json:"verifyModel"`
|
||||
VerifiedAt *time.Time `json:"verifiedAt"`
|
||||
VerifyError string `json:"verifyError"`
|
||||
Verified bool `json:"verified"`
|
||||
Status string `json:"status"`
|
||||
ValidateAvailability bool `json:"validateAvailability"`
|
||||
Remark string `json:"remark"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
|
||||
@@ -16,7 +16,7 @@ type AgentAccount struct {
|
||||
RememberAPIKey bool `json:"rememberApiKey"`
|
||||
VerifiedAt *time.Time `json:"verifiedAt"`
|
||||
VerifyError string `json:"verifyError"`
|
||||
Verified bool `json:"verified"`
|
||||
Status string `json:"status"`
|
||||
ValidateAvailability bool `json:"validateAvailability"`
|
||||
Remark string `json:"remark"`
|
||||
MasterAccountID uint `json:"masterAccountId" gorm:"index"`
|
||||
|
||||
@@ -42,7 +42,7 @@ func VerifyAccount(provider, apiType, authMode, baseURL, apiKey, model string) e
|
||||
httpReq.Header.Set(key, value)
|
||||
}
|
||||
httpReq.Header.Set("Accept", "application/json")
|
||||
resp, err := aihttp.NewClient(defaultVerifyTimeout).Do(httpReq)
|
||||
resp, err := aihttp.NewClient(15 * time.Second).Do(httpReq)
|
||||
if err != nil {
|
||||
return buserr.WithErr("ErrAgentAccountUnavailable", aihttp.SafeError(err, req.URL, apiKey))
|
||||
}
|
||||
|
||||
@@ -2,8 +2,10 @@ package repo
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/1Panel-dev/1Panel/agent/app/model"
|
||||
"github.com/1Panel-dev/1Panel/agent/constant"
|
||||
"github.com/1Panel-dev/1Panel/agent/global"
|
||||
"gorm.io/gorm"
|
||||
)
|
||||
@@ -17,6 +19,8 @@ type IAgentAccountRepo interface {
|
||||
Create(account *model.AgentAccount) error
|
||||
Save(account *model.AgentAccount) error
|
||||
UpdateVerification(account *model.AgentAccount) error
|
||||
UpdateStatus(id uint, status, verifyError string) error
|
||||
InterruptVerification() error
|
||||
ResetVerificationByAppInstallID(appInstallID uint) error
|
||||
DeleteByID(id uint) error
|
||||
List(opts ...DBOption) ([]model.AgentAccount, error)
|
||||
@@ -62,7 +66,7 @@ func (a AgentAccountRepo) Save(account *model.AgentAccount) error {
|
||||
|
||||
func (a AgentAccountRepo) UpdateVerification(account *model.AgentAccount) error {
|
||||
result := getDb().Model(&model.AgentAccount{}).Where("id = ?", account.ID).Updates(map[string]interface{}{
|
||||
"verified": account.Verified,
|
||||
"status": account.Status,
|
||||
"verified_at": account.VerifiedAt,
|
||||
"verify_error": account.VerifyError,
|
||||
"verify_model": account.VerifyModel,
|
||||
@@ -76,9 +80,21 @@ func (a AgentAccountRepo) UpdateVerification(account *model.AgentAccount) error
|
||||
return nil
|
||||
}
|
||||
|
||||
func (a AgentAccountRepo) UpdateStatus(id uint, status, verifyError string) error {
|
||||
return getDb().Model(&model.AgentAccount{}).Where("id = ?", id).UpdateColumns(map[string]interface{}{"status": status, "verify_error": verifyError}).Error
|
||||
}
|
||||
|
||||
func (a AgentAccountRepo) InterruptVerification() error {
|
||||
return getDb().Model(&model.AgentAccount{}).Where("status = ?", constant.StatusWaiting).Updates(map[string]interface{}{
|
||||
"status": constant.StatusFailed,
|
||||
"verified_at": time.Now(),
|
||||
"verify_error": constant.InterruptedMsg,
|
||||
}).Error
|
||||
}
|
||||
|
||||
func (a AgentAccountRepo) ResetVerificationByAppInstallID(appInstallID uint) error {
|
||||
return getDb().Model(&model.AgentAccount{}).Where("app_install_id = ? AND validate_availability = ?", appInstallID, true).Updates(map[string]interface{}{
|
||||
"verified": false,
|
||||
"status": constant.StatusPending,
|
||||
"verified_at": nil,
|
||||
"verify_error": "",
|
||||
}).Error
|
||||
|
||||
+23
-11
@@ -198,7 +198,7 @@ func (a AgentService) Create(req dto.AgentCreateReq) (*dto.AgentItem, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if account.ValidateAvailability && !account.Verified {
|
||||
if account.ValidateAvailability && account.Status != constant.StatusSuccess {
|
||||
return nil, buserr.New("ErrAgentAccountNotVerified")
|
||||
}
|
||||
provider = account.Provider
|
||||
@@ -721,7 +721,7 @@ func (a AgentService) ensureBatchInstallAccount(req dto.AgentBatchInstallReq) (u
|
||||
account.APIType = snapshot.APIType
|
||||
account.AuthMode = snapshot.AuthMode
|
||||
account.Remark = snapshot.Remark
|
||||
account.Verified = true
|
||||
account.Status = constant.StatusSuccess
|
||||
|
||||
initialModels, err := buildInitialAgentAccountModels(account, req.AccountModels)
|
||||
if err != nil {
|
||||
@@ -1070,11 +1070,12 @@ func (a AgentService) CreateAccount(req dto.AgentAccountCreateReq) error {
|
||||
APIType: resolvedInput.APIType,
|
||||
AuthMode: resolvedInput.AuthMode,
|
||||
VerifyModel: verifyModel,
|
||||
Verified: validateAvailability,
|
||||
Status: constant.StatusPending,
|
||||
ValidateAvailability: validateAvailability,
|
||||
Remark: req.Remark,
|
||||
}
|
||||
if validateAvailability {
|
||||
account.Status = constant.StatusSuccess
|
||||
now := time.Now()
|
||||
account.VerifiedAt = &now
|
||||
}
|
||||
@@ -1181,13 +1182,13 @@ func (a AgentService) UpdateAccount(req dto.AgentAccountUpdateReq) error {
|
||||
}
|
||||
}
|
||||
if account.ValidateAvailability && (!validateAvailability || connectionChanged) {
|
||||
account.Verified = false
|
||||
account.Status = constant.StatusPending
|
||||
account.VerifiedAt = nil
|
||||
account.VerifyError = ""
|
||||
}
|
||||
if shouldVerify {
|
||||
now := time.Now()
|
||||
account.Verified = true
|
||||
account.Status = constant.StatusSuccess
|
||||
account.VerifiedAt = &now
|
||||
account.VerifyError = ""
|
||||
}
|
||||
@@ -1282,7 +1283,7 @@ func (a AgentService) PageAccounts(req dto.AgentAccountSearch) (int64, []dto.Age
|
||||
APIType: item.APIType,
|
||||
AuthMode: item.AuthMode,
|
||||
VerifyModel: item.VerifyModel,
|
||||
Verified: item.Verified,
|
||||
Status: item.Status,
|
||||
ValidateAvailability: item.ValidateAvailability,
|
||||
VerifiedAt: item.VerifiedAt,
|
||||
VerifyError: item.VerifyError,
|
||||
@@ -1357,7 +1358,7 @@ func (a AgentService) UpdateAccountVerifyModel(req dto.AgentAccountVerifyModelUp
|
||||
previousVerifyModel = models[0].ID
|
||||
}
|
||||
if account.ValidateAvailability && !sameProviderModelID(account.Provider, previousVerifyModel, record.Model) {
|
||||
account.Verified = false
|
||||
account.Status = constant.StatusPending
|
||||
account.VerifiedAt = nil
|
||||
account.VerifyError = ""
|
||||
}
|
||||
@@ -1496,7 +1497,7 @@ func (a AgentService) UpdateAccountModel(req dto.AgentAccountModelUpdateReq) err
|
||||
return err
|
||||
}
|
||||
if account.ValidateAvailability && !sameProviderModelID(account.Provider, account.VerifyModel, verifyModel) {
|
||||
account.Verified, account.VerifiedAt, account.VerifyError = false, nil, ""
|
||||
account.Status, account.VerifiedAt, account.VerifyError = constant.StatusPending, nil, ""
|
||||
}
|
||||
account.VerifyModel = verifyModel
|
||||
rows := make([]model.AgentAccountModel, 0, len(models))
|
||||
@@ -1612,10 +1613,15 @@ func (a AgentService) VerifyAccount(req dto.AgentAccountVerifyReq) error {
|
||||
_, err := resolveAgentAccountInput(req.Provider, req.APIType, req.AuthMode, req.APIKey, req.BaseURL, req.Model, true, false)
|
||||
return err
|
||||
}
|
||||
agentAccountMutationMu.Lock()
|
||||
defer agentAccountMutationMu.Unlock()
|
||||
account, err := agentAccountRepo.GetFirst(repo.WithByID(req.ID))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if account.Status == constant.StatusWaiting {
|
||||
return buserr.WithDetail("ErrInvalidParams", "model service verification is already in progress", nil)
|
||||
}
|
||||
if !account.ValidateAvailability {
|
||||
return nil
|
||||
}
|
||||
@@ -1623,21 +1629,27 @@ func (a AgentService) VerifyAccount(req dto.AgentAccountVerifyReq) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := agentAccountRepo.UpdateStatus(account.ID, constant.StatusWaiting, ""); err != nil {
|
||||
return err
|
||||
}
|
||||
account.Status = constant.StatusWaiting
|
||||
account.VerifyError = ""
|
||||
agentAccountMutationMu.Unlock()
|
||||
verifyModel, verifyErr := resolveAgentAccountVerifyModel(account.Provider, account.VerifyModel, models)
|
||||
if verifyErr == nil {
|
||||
verifyErr = providercatalog.VerifyAccount(account.Provider, account.APIType, account.AuthMode, account.BaseURL, account.APIKey, verifyModel)
|
||||
}
|
||||
agentAccountMutationMu.Lock()
|
||||
defer agentAccountMutationMu.Unlock()
|
||||
if err := ensureAgentAccountUnchanged(account, models); err != nil {
|
||||
return err
|
||||
return errors.Join(err, agentAccountRepo.UpdateStatus(account.ID, constant.StatusFailed, err.Error()))
|
||||
}
|
||||
now := time.Now()
|
||||
account.VerifyModel = verifyModel
|
||||
account.VerifiedAt = &now
|
||||
account.Verified = verifyErr == nil
|
||||
account.Status = constant.StatusSuccess
|
||||
account.VerifyError = ""
|
||||
if verifyErr != nil {
|
||||
account.Status = constant.StatusFailed
|
||||
account.VerifyError = verifyErr.Error()
|
||||
}
|
||||
err = agentAccountRepo.UpdateVerification(account)
|
||||
|
||||
@@ -58,7 +58,7 @@ func SyncLocalModelAccount(install model.AppInstall, accountID uint, baseURL str
|
||||
if install.App.Key == "ollama" {
|
||||
apiType, apiKey = "openai-responses", "ollama-local"
|
||||
}
|
||||
account = &model.AgentAccount{Name: name, Provider: install.App.Key, BaseURL: baseURL, APIType: apiType, APIKey: apiKey, RememberAPIKey: true, ValidateAvailability: true}
|
||||
account = &model.AgentAccount{Name: name, Provider: install.App.Key, BaseURL: baseURL, APIType: apiType, APIKey: apiKey, RememberAPIKey: true, ValidateAvailability: true, Status: constant.StatusPending}
|
||||
}
|
||||
accountChanged := account.ID == 0 || account.AppInstallID != install.ID || (updateBaseURL && account.BaseURL != baseURL)
|
||||
if apiKey != nil && account.APIKey != strings.TrimSpace(*apiKey) {
|
||||
@@ -82,7 +82,7 @@ func SyncLocalModelAccount(install model.AppInstall, accountID uint, baseURL str
|
||||
accountChanged = true
|
||||
}
|
||||
if accountChanged && account.ValidateAvailability {
|
||||
account.Verified = false
|
||||
account.Status = constant.StatusPending
|
||||
account.VerifiedAt = nil
|
||||
account.VerifyError = ""
|
||||
}
|
||||
@@ -129,7 +129,7 @@ func UpdateLocalModelAccountAddress(accountID uint, previousURL, baseURL string)
|
||||
}
|
||||
account.BaseURL = baseURL
|
||||
if account.ValidateAvailability {
|
||||
account.Verified = false
|
||||
account.Status = constant.StatusPending
|
||||
account.VerifiedAt = nil
|
||||
account.VerifyError = ""
|
||||
}
|
||||
@@ -211,7 +211,7 @@ func updateOllamaModelPool(modelName string, remove bool) error {
|
||||
if sameProviderModelID("ollama", account.VerifyModel, modelName) {
|
||||
account.VerifyModel = ""
|
||||
if account.ValidateAvailability {
|
||||
account.Verified = false
|
||||
account.Status = constant.StatusPending
|
||||
account.VerifiedAt = nil
|
||||
account.VerifyError = ""
|
||||
}
|
||||
|
||||
@@ -24,6 +24,9 @@ func Init() {
|
||||
handleRecordStatus()
|
||||
handleSnapStatus()
|
||||
handleOllamaModelStatus()
|
||||
if err := repo.NewIAgentAccountRepo().InterruptVerification(); err != nil {
|
||||
global.LOG.Errorf("reset model service verification status failed: %v", err)
|
||||
}
|
||||
|
||||
loadLocalDir()
|
||||
|
||||
|
||||
@@ -122,6 +122,7 @@ func agentDBMigrations() []*gormigrate.Migration {
|
||||
migrations.AddAgentAccountVerificationResult,
|
||||
migrations.AddAgentAccountType,
|
||||
migrations.AddGPUGroup,
|
||||
migrations.AddAgentAccountStatus,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1234,6 +1234,9 @@ var NormalizeAgentAccountVerifiedStatus = &gormigrate.Migration{
|
||||
if err := tx.AutoMigrate(&model.AgentAccount{}); err != nil {
|
||||
return err
|
||||
}
|
||||
if !tx.Migrator().HasColumn(&model.AgentAccount{}, "verified") {
|
||||
return nil
|
||||
}
|
||||
return tx.Model(&model.AgentAccount{}).
|
||||
Where("provider IN ?", []string{"custom", "ollama", "kimi-coding"}).
|
||||
Update("verified", false).Error
|
||||
@@ -1956,3 +1959,29 @@ var AddCronjobURLItems = &gormigrate.Migration{
|
||||
return tx.Migrator().AddColumn(&model.Cronjob{}, "URLItemsJSON")
|
||||
},
|
||||
}
|
||||
|
||||
var AddAgentAccountStatus = &gormigrate.Migration{
|
||||
ID: "20261116-add-agent-account-status",
|
||||
Migrate: func(tx *gorm.DB) error {
|
||||
if err := tx.AutoMigrate(&model.AgentAccount{}); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := tx.Model(&model.AgentAccount{}).Where("status IS NULL OR status = ?", "").Update("status", constant.StatusPending).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
if tx.Migrator().HasColumn(&model.AgentAccount{}, "verified") {
|
||||
if err := tx.Model(&model.AgentAccount{}).Where("verified = ?", true).Update("status", constant.StatusSuccess).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if tx.Migrator().HasColumn(&model.AgentAccount{}, "verify_error") {
|
||||
if err := tx.Model(&model.AgentAccount{}).Where("verify_error <> ?", "").Update("status", constant.StatusFailed).Error; err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if tx.Migrator().HasColumn(&model.AgentAccount{}, "verifying") {
|
||||
return tx.Model(&model.AgentAccount{}).Where("verifying = ?", true).Update("status", constant.StatusWaiting).Error
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
@@ -795,7 +795,7 @@ export namespace AI {
|
||||
apiType: string;
|
||||
authMode: string;
|
||||
verifyModel: string;
|
||||
verified: boolean;
|
||||
status: string;
|
||||
validateAvailability: boolean;
|
||||
verifiedAt?: string | null;
|
||||
verifyError?: string;
|
||||
|
||||
@@ -267,7 +267,7 @@ export const updateAgentAccountModel = (req: AI.AgentAccountModelUpdateReq) => {
|
||||
|
||||
export const verifyAgentAccount = (req: { id: number }, currentNode: string) => {
|
||||
return http.postWithConfig(`/ai/accounts/verify`, req, {
|
||||
timeout: TimeoutEnum.T_60S,
|
||||
timeout: 20_000,
|
||||
errorMessageMode: 'manual',
|
||||
headers: { CurrentNode: currentNode },
|
||||
});
|
||||
|
||||
@@ -122,7 +122,12 @@
|
||||
:visible-count="1"
|
||||
>
|
||||
<template v-if="!row.appInstallId" #footer>
|
||||
<el-button link type="primary" @click="poolRef.open(row)">
|
||||
<el-button
|
||||
link
|
||||
type="primary"
|
||||
:disabled="row.status === 'Waiting'"
|
||||
@click="poolRef.open(row)"
|
||||
>
|
||||
{{ $t('aiTools.agents.modelPool') }}
|
||||
</el-button>
|
||||
</template>
|
||||
@@ -130,7 +135,7 @@
|
||||
<span v-if="!row.models?.length">—</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column prop="verified" :label="$t('aiTools.model.connectionStatus')" min-width="130">
|
||||
<el-table-column prop="status" :label="$t('aiTools.model.connectionStatus')" min-width="130">
|
||||
<template #default="{ row }">
|
||||
<div class="verification-status">
|
||||
<el-tooltip
|
||||
@@ -164,7 +169,7 @@
|
||||
type="primary"
|
||||
:icon="RefreshRight"
|
||||
:aria-label="$t('aiTools.model.reverify')"
|
||||
:disabled="verifyingAccounts.has(`${currentNode}:${row.id}`)"
|
||||
:disabled="row.status === 'Waiting'"
|
||||
@click="verifyTarget = { account: row, node: currentNode }"
|
||||
/>
|
||||
</el-tooltip>
|
||||
@@ -248,7 +253,7 @@
|
||||
:model-value="true"
|
||||
:account="detailAccount"
|
||||
:status="connectionStatus(detailAccount)"
|
||||
:verifying="verifyingAccounts.has(`${currentNode}:${detailAccount.id}`)"
|
||||
:verifying="detailAccount.status === 'Waiting'"
|
||||
@update:model-value="!$event && (detailAccountID = undefined)"
|
||||
@edit="createRef.openAccount(detailAccount)"
|
||||
@models="poolRef.open(detailAccount)"
|
||||
@@ -291,7 +296,6 @@ const createRef = ref();
|
||||
const poolRef = ref();
|
||||
const chatRef = ref<InstanceType<typeof ModelChat>>();
|
||||
const loading = ref(false);
|
||||
const verifyingAccounts = reactive(new Set<string>());
|
||||
const verifyTarget = ref<{ account: AI.AgentAccountItem; node: string }>();
|
||||
const verifyDialogVisible = computed({
|
||||
get: () => Boolean(verifyTarget.value),
|
||||
@@ -409,18 +413,18 @@ const search = async () => {
|
||||
};
|
||||
|
||||
const connectionStatus = (row: AI.AgentAccountItem) => {
|
||||
if (verifyingAccounts.has(`${currentNode.value}:${row.id}`)) {
|
||||
if (row.status === 'Waiting') {
|
||||
return { type: 'info' as const, label: i18n.global.t('aiTools.model.verifying') };
|
||||
}
|
||||
if (!row.validateAvailability) {
|
||||
return { type: 'success' as const, label: i18n.global.t('aiTools.agents.verifySkipped') };
|
||||
}
|
||||
if (row.verifyError) {
|
||||
if (row.status === 'Failed') {
|
||||
return { type: 'danger' as const, label: i18n.global.t('aiTools.model.verifyFailed') };
|
||||
}
|
||||
return {
|
||||
type: row.verified ? ('success' as const) : ('warning' as const),
|
||||
label: i18n.global.t(row.verified ? 'aiTools.agents.verified' : 'aiTools.model.unverified'),
|
||||
type: row.status === 'Success' ? ('success' as const) : ('warning' as const),
|
||||
label: i18n.global.t(row.status === 'Success' ? 'aiTools.agents.verified' : 'aiTools.model.unverified'),
|
||||
};
|
||||
};
|
||||
|
||||
@@ -428,17 +432,16 @@ const verifyAccount = async () => {
|
||||
if (!verifyTarget.value) return;
|
||||
const { account: row, node } = verifyTarget.value;
|
||||
verifyTarget.value = undefined;
|
||||
const key = `${node}:${row.id}`;
|
||||
if (!row.validateAvailability || currentNode.value !== node || !isCurrentPage.value || verifyingAccounts.has(key))
|
||||
if (!row.validateAvailability || currentNode.value !== node || !isCurrentPage.value || row.status === 'Waiting')
|
||||
return;
|
||||
verifyingAccounts.add(key);
|
||||
row.status = 'Waiting';
|
||||
row.verifyError = '';
|
||||
try {
|
||||
await verifyAgentAccount({ id: row.id }, node);
|
||||
MsgSuccess(i18n.global.t('aiTools.agents.verified'));
|
||||
} catch (error: any) {
|
||||
MsgError(String(error?.response?.data?.message || error?.message || i18n.global.t('commons.res.commonError')));
|
||||
} finally {
|
||||
verifyingAccounts.delete(key);
|
||||
if (currentNode.value === node) await search();
|
||||
}
|
||||
};
|
||||
@@ -463,16 +466,18 @@ const accountButtons = [
|
||||
{
|
||||
label: i18n.global.t('commons.button.edit'),
|
||||
permission: true,
|
||||
disabled: (row: AI.AgentAccountItem) => row.status === 'Waiting',
|
||||
click: (row: AI.AgentAccountItem) => createRef.value.openAccount(row),
|
||||
},
|
||||
{
|
||||
label: i18n.global.t('aiTools.agents.modelPool'),
|
||||
disabled: (row: AI.AgentAccountItem) => row.provider === 'vllm',
|
||||
disabled: (row: AI.AgentAccountItem) => row.provider === 'vllm' || row.status === 'Waiting',
|
||||
click: (row: AI.AgentAccountItem) => poolRef.value.open(row),
|
||||
},
|
||||
{
|
||||
label: i18n.global.t('commons.button.delete'),
|
||||
permission: true,
|
||||
disabled: (row: AI.AgentAccountItem) => row.status === 'Waiting',
|
||||
click: async (row: AI.AgentAccountItem) => {
|
||||
await ElMessageBox.confirm(
|
||||
i18n.global.t('commons.msg.delete', [row.name]),
|
||||
|
||||
@@ -651,7 +651,7 @@ const fileAiAgentAccountOptions = ref<
|
||||
name: string;
|
||||
provider?: string;
|
||||
providerName?: string;
|
||||
verified?: boolean;
|
||||
status?: string;
|
||||
validateAvailability?: boolean;
|
||||
}>
|
||||
>([]);
|
||||
@@ -667,14 +667,14 @@ const loadFileAiAgentAccounts = async () => {
|
||||
fileAiAgentAccountOptions.value = res.data?.items || [];
|
||||
};
|
||||
|
||||
const fileAiVerificationLabel = (item: { provider?: string; verified?: boolean; validateAvailability?: boolean }) => {
|
||||
const fileAiVerificationLabel = (item: { provider?: string; status?: string; validateAvailability?: boolean }) => {
|
||||
if (item.validateAvailability === false) return i18n.global.t('aiTools.agents.verifySkipped');
|
||||
return item.verified ? 'OK' : 'N/A';
|
||||
return item.status === 'Success' ? 'OK' : 'N/A';
|
||||
};
|
||||
|
||||
const fileAiVerificationTagType = (item: { provider?: string; verified?: boolean; validateAvailability?: boolean }) => {
|
||||
const fileAiVerificationTagType = (item: { provider?: string; status?: string; validateAvailability?: boolean }) => {
|
||||
if (item.validateAvailability === false) return 'info';
|
||||
return item.verified ? 'success' : 'warning';
|
||||
return item.status === 'Success' ? 'success' : 'warning';
|
||||
};
|
||||
|
||||
const saveFileAiManageSettings = async () => {
|
||||
|
||||
@@ -91,7 +91,7 @@ interface AgentAccountOption {
|
||||
name: string;
|
||||
provider?: string;
|
||||
providerName?: string;
|
||||
verified?: boolean;
|
||||
status?: string;
|
||||
validateAvailability?: boolean;
|
||||
}
|
||||
|
||||
@@ -128,12 +128,12 @@ const openDrawer = () => {
|
||||
|
||||
const verificationLabel = (item: AgentAccountOption) => {
|
||||
if (item.validateAvailability === false) return i18n.global.t('aiTools.agents.verifySkipped');
|
||||
return item.verified ? 'OK' : 'N/A';
|
||||
return item.status === 'Success' ? 'OK' : 'N/A';
|
||||
};
|
||||
|
||||
const verificationTagType = (item: AgentAccountOption) => {
|
||||
if (item.validateAvailability === false) return 'info';
|
||||
return item.verified ? 'success' : 'warning';
|
||||
return item.status === 'Success' ? 'success' : 'warning';
|
||||
};
|
||||
|
||||
const loadAgentAccounts = async () => {
|
||||
|
||||
Reference in New Issue
Block a user