mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-28 09:03:53 +00:00
feat: admin image
This commit is contained in:
@@ -4,18 +4,34 @@ import {
|
||||
ListTable,
|
||||
Resource,
|
||||
Tushan,
|
||||
fetchJSON
|
||||
} from 'tushan';
|
||||
import { authProvider } from './auth';
|
||||
import { userFields,payFields,kbFields,ModelFields } from './fields';
|
||||
import { userFields, payFields, kbFields, ModelFields } from './fields';
|
||||
|
||||
const dataProvider = jsonServerProvider('http://localhost:3001');
|
||||
const authStorageKey = 'tushan:auth';
|
||||
|
||||
const httpClient: typeof fetchJSON = (url, options = {}) => {
|
||||
try {
|
||||
if (!options.headers) {
|
||||
options.headers = new Headers({ Accept: 'application/json' });
|
||||
}
|
||||
const { token } = JSON.parse(window.localStorage.getItem(authStorageKey) ?? '{}');
|
||||
(options.headers as Headers).set('Authorization', `Bearer ${token}`);
|
||||
|
||||
return fetchJSON(url, options);
|
||||
} catch (err) {
|
||||
return Promise.reject();
|
||||
}
|
||||
};
|
||||
|
||||
const dataProvider = jsonServerProvider(import.meta.env.VITE_PUBLIC_SERVER_URL, httpClient);
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<Tushan
|
||||
basename="/"
|
||||
header={'fastgpt-admin'}
|
||||
footer={'Build with stakeswky'}
|
||||
header={'FastGpt-Admin'}
|
||||
dataProvider={dataProvider}
|
||||
authProvider={authProvider}
|
||||
>
|
||||
@@ -25,12 +41,12 @@ function App() {
|
||||
list={
|
||||
<ListTable
|
||||
filter={[
|
||||
createTextField('q', {
|
||||
label: 'Query',
|
||||
}),
|
||||
createTextField('username', {
|
||||
label: 'username'
|
||||
})
|
||||
]}
|
||||
fields={userFields}
|
||||
action={{ create: true, detail: true, edit: true, delete: true }}
|
||||
action={{ create: true, detail: true, edit: true }}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
@@ -40,6 +56,11 @@ function App() {
|
||||
label="支付记录"
|
||||
list={
|
||||
<ListTable
|
||||
filter={[
|
||||
createTextField('userId', {
|
||||
label: 'userId'
|
||||
})
|
||||
]}
|
||||
fields={payFields}
|
||||
action={{ detail: true }}
|
||||
/>
|
||||
@@ -50,6 +71,11 @@ function App() {
|
||||
label="知识库"
|
||||
list={
|
||||
<ListTable
|
||||
filter={[
|
||||
createTextField('tag', {
|
||||
label: 'tag'
|
||||
})
|
||||
]}
|
||||
fields={kbFields}
|
||||
action={{ detail: true }}
|
||||
/>
|
||||
@@ -57,13 +83,8 @@ function App() {
|
||||
/>
|
||||
<Resource
|
||||
name="models"
|
||||
label="Ai模型"
|
||||
list={
|
||||
<ListTable
|
||||
fields={ModelFields}
|
||||
action={{ detail: true }}
|
||||
/>
|
||||
}
|
||||
label="应用"
|
||||
list={<ListTable fields={ModelFields} action={{ detail: true }} />}
|
||||
/>
|
||||
</Tushan>
|
||||
);
|
||||
|
Reference in New Issue
Block a user