mirror of
https://github.com/coaidev/coai.git
synced 2025-06-01 19:30:19 +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[];
|
||||
|
||||
const initialState: MarketForm = [];
|
||||
|
||||
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 {
|
||||
switch (action.type) {
|
||||
case "set":
|
||||
@ -332,10 +343,10 @@ function Market() {
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
if (form.length === 0 && supportModels.length > 0) {
|
||||
if (supportModels.length > 0 && !sync.current) {
|
||||
dispatch({ type: "set", payload: [...supportModels] });
|
||||
sync.current = true;
|
||||
}
|
||||
sync.current = true;
|
||||
}, [supportModels]);
|
||||
|
||||
useEffect(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user