@@ -39,7 +39,7 @@ import type {
3939 ModelCatalog ,
4040 ModelProvider ,
4141} from "@corbits-builder/schemas/models" ;
42- import { Banner , Button , QuietState } from "../components.jsx" ;
42+ import { Button , QuietState } from "../components.jsx" ;
4343import { keys } from "../queries/keys.ts" ;
4444import { productClient } from "../api/transport.ts" ;
4545import { workspaceTenantId } from "../api/auth.ts" ;
@@ -128,13 +128,12 @@ export function message(cause: unknown): string {
128128 return cause instanceof Error ? cause . message : String ( cause ) ;
129129}
130130
131- /** Title, lead, the fields, the last error, and Cancel or Back beside the dialog's action. */
131+ /** Title, lead, the fields, and Cancel or Back beside the dialog's action. */
132132export function ProviderDialog ( props : {
133133 open : boolean ;
134134 onOpenChange : ( open : boolean ) => void ;
135135 title : string ;
136136 description : string ;
137- error : string | null ;
138137 busy : boolean ;
139138 ready : boolean ;
140139 /** Whether submitting tests a connection first. */
@@ -148,7 +147,7 @@ export function ProviderDialog(props: {
148147 focusDialog ?: boolean ;
149148 children : ReactNode ;
150149} ) {
151- const { busy, error , onBack, onOpenChange } = props ;
150+ const { busy, onBack, onOpenChange } = props ;
152151 return (
153152 < Dialog open = { props . open } onOpenChange = { onOpenChange } >
154153 < DialogContent
@@ -178,7 +177,6 @@ export function ProviderDialog(props: {
178177 }
179178 >
180179 { props . children }
181- { error ? < Banner tone = "error" title = { error } /> : null }
182180 </ DialogBody >
183181 < DialogFooter >
184182 < Button
@@ -724,12 +722,10 @@ export function CustomProviderRow({
724722 provider,
725723 apis,
726724 onChanged,
727- onError,
728725} : {
729726 provider : ModelProvider ;
730727 apis : Apis ;
731728 onChanged : ( ) => void ;
732- onError : ( message : string | null ) => void ;
733729} ) {
734730 const [ open , setOpen ] = useState ( false ) ;
735731 const listId = `custom-models-${ provider . id } ` ;
@@ -755,7 +751,6 @@ export function CustomProviderRow({
755751 provider = { provider }
756752 apis = { apis }
757753 onChanged = { onChanged }
758- onError = { onError }
759754 />
760755 </ span >
761756 </ div >
@@ -780,7 +775,6 @@ function CustomProviderModels({
780775 provider . models . map ( ( model ) => ( { ...modelDraftOf ( model ) , fixed : true } ) ) ,
781776 ) ;
782777 const [ saveState , setSaveState ] = useState < SaveState | null > ( null ) ;
783- const [ error , setError ] = useState < string | null > ( null ) ;
784778 const saved = useRef ( JSON . stringify ( parsedModels ( models ) ) ) ;
785779
786780 // Saves once the list is complete and differs from what the hub holds; a half-typed model waits.
@@ -789,7 +783,6 @@ function CustomProviderModels({
789783 const snapshot = JSON . stringify ( parsed ) ;
790784 if ( ! parsed || snapshot === saved . current ) return ;
791785 setSaveState ( "saving" ) ;
792- setError ( null ) ;
793786 try {
794787 await productClient ( ) . updateCustomProvider (
795788 await workspaceTenantId ( ) ,
@@ -808,7 +801,7 @@ function CustomProviderModels({
808801 onChanged ( ) ;
809802 } catch ( cause ) {
810803 setSaveState ( "failed" ) ;
811- setError ( message ( cause ) ) ;
804+ toast . error ( message ( cause ) ) ;
812805 }
813806 } ;
814807
@@ -861,7 +854,6 @@ function CustomProviderModels({
861854 { copy . custom . addModel }
862855 </ Button >
863856 </ div >
864- { error ? < Banner tone = "error" title = { error } /> : null }
865857 </ >
866858 ) ;
867859}
@@ -871,12 +863,10 @@ function CustomProviderActions({
871863 provider,
872864 apis,
873865 onChanged,
874- onError,
875866} : {
876867 provider : ModelProvider ;
877868 apis : Apis ;
878869 onChanged : ( ) => void ;
879- onError : ( message : string | null ) => void ;
880870} ) {
881871 const queryClient = useQueryClient ( ) ;
882872 const [ editing , setEditing ] = useState ( false ) ;
@@ -886,7 +876,6 @@ function CustomProviderActions({
886876
887877 const remove = async ( ) => {
888878 setRemoving ( true ) ;
889- onError ( null ) ;
890879 try {
891880 await productClient ( ) . removeCustomProvider (
892881 await workspaceTenantId ( ) ,
@@ -896,7 +885,7 @@ function CustomProviderActions({
896885 await queryClient . invalidateQueries ( { queryKey : keys . modelCatalog } ) ;
897886 onChanged ( ) ;
898887 } catch ( cause ) {
899- onError ( message ( cause ) ) ;
888+ toast . error ( message ( cause ) ) ;
900889 } finally {
901890 setRemoving ( false ) ;
902891 }
@@ -971,20 +960,18 @@ function EditCustomProviderDialog({
971960 const queryClient = useQueryClient ( ) ;
972961 const form = useCustomProviderForm ( apis , provider ) ;
973962 const [ busy , setBusy ] = useState ( false ) ;
974- const [ error , setError ] = useState < string | null > ( null ) ;
975963
976964 const save = async ( ) => {
977965 if ( ! form . ready || busy ) return ;
978966 setBusy ( true ) ;
979- setError ( null ) ;
980967 try {
981968 await form . save ( ) ;
982969 toast . success ( copy . custom . saved ( form . name ) ) ;
983970 await queryClient . invalidateQueries ( { queryKey : keys . modelCatalog } ) ;
984971 onSaved ( ) ;
985972 onClose ( ) ;
986973 } catch ( cause ) {
987- setError ( message ( cause ) ) ;
974+ toast . error ( message ( cause ) ) ;
988975 } finally {
989976 setBusy ( false ) ;
990977 }
@@ -996,7 +983,6 @@ function EditCustomProviderDialog({
996983 onOpenChange = { ( open ) => ( open || busy ? undefined : onClose ( ) ) }
997984 title = { copy . custom . editTitle ( provider . label ) }
998985 description = { copy . custom . editLead }
999- error = { error }
1000986 busy = { busy }
1001987 ready = { form . ready }
1002988 tests = { form . tests }
0 commit comments