mirror of
https://github.com/coaidev/coai.git
synced 2025-06-03 04:10:21 +09:00
feat: add default model
This commit is contained in:
parent
09bf1be79e
commit
1884a9484a
@ -38,10 +38,21 @@ type Model = RawModel & {
|
|||||||
|
|
||||||
type MarketForm = Model[];
|
type MarketForm = Model[];
|
||||||
|
|
||||||
const initialState: MarketForm = [];
|
|
||||||
|
|
||||||
const generateSeed = () => generateRandomChar(8);
|
const generateSeed = () => generateRandomChar(8);
|
||||||
|
|
||||||
|
const initialState: MarketForm = [{
|
||||||
|
id: "",
|
||||||
|
name: "",
|
||||||
|
free: false,
|
||||||
|
auth: false,
|
||||||
|
description: "",
|
||||||
|
high_context: false,
|
||||||
|
default: false,
|
||||||
|
tag: [],
|
||||||
|
avatar: modelImages[0],
|
||||||
|
seed: generateSeed(),
|
||||||
|
}];
|
||||||
|
|
||||||
function reducer(state: MarketForm, action: any): MarketForm {
|
function reducer(state: MarketForm, action: any): MarketForm {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case "set":
|
case "set":
|
||||||
@ -332,10 +343,10 @@ function Market() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (form.length === 0 && supportModels.length > 0) {
|
if (supportModels.length > 0 && !sync.current) {
|
||||||
dispatch({ type: "set", payload: [...supportModels] });
|
dispatch({ type: "set", payload: [...supportModels] });
|
||||||
|
sync.current = true;
|
||||||
}
|
}
|
||||||
sync.current = true;
|
|
||||||
}, [supportModels]);
|
}, [supportModels]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
Loading…
Reference in New Issue
Block a user