@@ -119,9 +119,38 @@ check_connection_exists:
119119validate_connection_exists :
120120 switch :
121121 - condition : " ${existing_connection.response.body.length > 0}"
122- next : update_llm_connection
122+ next : check_deployment_environment
123123 next : return_not_found
124124
125+ check_deployment_environment :
126+ switch :
127+ - condition : ${environment == "production" && existing_connection.response.body[0].environment == "testing"}
128+ next : get_existing_production_connection
129+ next : update_llm_connection
130+
131+ get_existing_production_connection :
132+ call : http.post
133+ args :
134+ url : " [#RAG_SEARCH_RESQL]/get-production-connection"
135+ result : existing_production_result
136+ next : update_existing_production_to_testing
137+
138+ update_existing_production_to_testing :
139+ switch :
140+ - condition : ${existing_production_result.response.body && existing_production_result.response.body.length > 0}
141+ next : update_production_connection
142+ next : update_llm_connection
143+
144+ update_production_connection :
145+ call : http.post
146+ args :
147+ url : " [#RAG_SEARCH_RESQL]/update-llm-connection-environment"
148+ body :
149+ connection_id : ${existing_production_result.response.body[0].id}
150+ environment : " testing"
151+ result : update_result
152+ next : update_llm_connection
153+
125154update_llm_connection :
126155 call : http.post
127156 args :
@@ -169,4 +198,4 @@ return_invalid_environment:
169198return_unauthorized :
170199 status : 401
171200 return : " error: unauthorized"
172- next : end
201+ next : end
0 commit comments