@@ -731,14 +731,17 @@ func (d *deployer) UpdateDeploy(ctx context.Context, dur *types.DeployUpdateReq,
731731 deploy .EngineArgs = * dur .EngineArgs
732732 }
733733
734- if dur . Entrypoint != nil {
735- if deploy . RuntimeFramework == string ( types . LlamaCpp ) {
736- newVarStr , err := buildVariables (dur )
734+ if isGGUFRuntime ( deploy . RuntimeFramework ) {
735+ if dur . Entrypoint != nil {
736+ newVarStr , err := buildVariables (deploy . Variables , dur )
737737 if err != nil {
738738 return fmt .Errorf ("build variables for llama cpp error: %w" , err )
739739 }
740740 dur .Variables = & newVarStr
741741 }
742+ if ! hasGGUFEntryPoint (dur .Variables , deploy .Variables ) {
743+ return fmt .Errorf ("entrypoint is required for llama.cpp or ktransformers" )
744+ }
742745 }
743746
744747 if dur .Variables != nil {
@@ -761,8 +764,13 @@ func (d *deployer) UpdateDeploy(ctx context.Context, dur *types.DeployUpdateReq,
761764 return nil
762765}
763766
764- func buildVariables (dur * types.DeployUpdateReq ) (string , error ) {
765- varStr := ""
767+ func isGGUFRuntime (runtimeFramework string ) bool {
768+ name := strings .ToLower (runtimeFramework )
769+ return strings .Contains (name , string (types .LlamaCpp )) || strings .Contains (name , string (types .Ktransformers ))
770+ }
771+
772+ func buildVariables (existingVariables string , dur * types.DeployUpdateReq ) (string , error ) {
773+ varStr := existingVariables
766774 if dur .Variables != nil {
767775 varStr = * dur .Variables
768776 }
@@ -779,6 +787,18 @@ func buildVariables(dur *types.DeployUpdateReq) (string, error) {
779787 return varStr , nil
780788}
781789
790+ func hasGGUFEntryPoint (variables * string , existingVariables string ) bool {
791+ varStr := existingVariables
792+ if variables != nil {
793+ varStr = * variables
794+ }
795+ varMap , err := hubcom .JsonStrToMap (varStr )
796+ if err != nil {
797+ return false
798+ }
799+ return strings .TrimSpace (varMap [types .GGUFEntryPoint ]) != ""
800+ }
801+
782802func (d * deployer ) StartDeploy (ctx context.Context , deploy * database.Deploy ) error {
783803 deploy .Status = common .Pending
784804 // update deploy table
0 commit comments