feat(ai-web): 尝试使用jpa作为通用数据库后端

This commit is contained in:
2025-06-23 00:26:31 +08:00
parent 306c20aa7f
commit e48d7e8649
38 changed files with 1141 additions and 452 deletions

View File

@@ -1,6 +1,13 @@
import React from 'react'
import styled from 'styled-components'
import {amisRender, commonInfo, crudCommonOptions, mappingField, mappingItem} from '../../../util/amis.tsx'
import {
amisRender,
commonInfo,
crudCommonOptions,
mappingField,
mappingItem,
pictureFromIds
} from '../../../util/amis.tsx'
const FeedbackDiv = styled.div`
.feedback-list-images {
@@ -29,7 +36,16 @@ const Feedback: React.FC = () => {
body: [
{
type: 'crud',
api: `${commonInfo.baseAiUrl}/feedback/list`,
api: {
method: 'post',
url: `${commonInfo.baseAiUrl}/feedback/list`,
data: {
page: {
index: '${page}',
size: '${perPage}',
}
}
},
...crudCommonOptions(),
headerToolbar: [
'reload',
@@ -46,7 +62,7 @@ const Feedback: React.FC = () => {
body: {
debug: commonInfo.debug,
type: 'form',
api: `${commonInfo.baseAiUrl}/feedback/add`,
api: `${commonInfo.baseAiUrl}/feedback/save`,
body: [
{
type: 'editor',
@@ -100,7 +116,7 @@ const Feedback: React.FC = () => {
type: 'images',
enlargeAble: true,
enlargeWithGallary: true,
source: '${pictures}',
source: pictureFromIds('pictures'),
showToolbar: true,
},
],
@@ -123,13 +139,7 @@ const Feedback: React.FC = () => {
level: 'link',
size: 'sm',
actionType: 'ajax',
api: {
method: 'get',
url: `${commonInfo.baseAiUrl}/feedback/reanalysis`,
data: {
id: '${id}',
},
},
api: `get:${commonInfo.baseAiUrl}/feedback/reanalysis/\${id}`,
confirmText: '确认执行重新分析?',
confirmTitle: '重新分析',
},
@@ -186,6 +196,7 @@ const Feedback: React.FC = () => {
enlargeAble: true,
enlargeWithGallary: true,
showToolbar: true,
source: pictureFromIds('pictures'),
},
},
{
@@ -221,13 +232,7 @@ const Feedback: React.FC = () => {
level: 'link',
size: 'sm',
actionType: 'ajax',
api: {
method: 'get',
url: `${commonInfo.baseAiUrl}/feedback/delete`,
data: {
id: '${id}',
},
},
api: `get:${commonInfo.baseAiUrl}/feedback/remove/\${id}`,
confirmTitle: '删除',
confirmText: '删除后将无法恢复,确认删除?',
},

View File

@@ -10,8 +10,8 @@ import {isEqual} from 'licia'
export const commonInfo = {
debug: isEqual(import.meta.env.MODE, 'development'),
baseUrl: 'http://132.126.207.130:35690/hudi_services/service_web',
baseAiUrl: 'http://132.126.207.130:35690/hudi_services/service_ai_web',
// baseAiUrl: 'http://localhost:8080',
// baseAiUrl: 'http://132.126.207.130:35690/hudi_services/service_ai_web',
baseAiUrl: 'http://localhost:8080',
authorizationHeaders: {
'Authorization': 'Basic QXhoRWJzY3dzSkRiWU1IMjpjWXhnM2I0UHRXb1ZENVNqRmF5V3h0blNWc2p6UnNnNA==',
'Content-Type': 'application/json',
@@ -2502,4 +2502,8 @@ export function time(field: string) {
type: 'tpl',
tpl: `\${IF(${field}, DATETOSTR(${field}, 'YYYY-MM-DD HH:mm:ss'), undefined)}`,
}
}
export function pictureFromIds(field: string) {
return `\${ARRAYMAP(${field},id => '${commonInfo.baseAiUrl}/upload/download/' + id)}`
}