Dolor David Prince
fix: add use client directive to all components for static export
c9d42cc
Raw
History Blame Contribute Delete
740 Bytes
'use client';
"use client";
import {useState} from "react";
import models from "../services/models/client";
export default function useModels(){
const [loading,setLoading]=useState(false);
async function exec(fn,...args){
setLoading(true);
try{
const {data}=await fn(...args);
return data;
}finally{
setLoading(false);
}
}
return{
loading,
list:(...a)=>exec(models.list,...a),
running:(...a)=>exec(models.running,...a),
download:(...a)=>exec(models.download,...a),
load:(...a)=>exec(models.load,...a),
unload:(...a)=>exec(models.unload,...a),
remove:(...a)=>exec(models.remove,...a),
chat:(...a)=>exec(models.chat,...a),
embeddings:(...a)=>exec(models.embeddings,...a),
health:(...a)=>exec(models.health,...a)
};
}