MCPcopy Create free account
hub / github.com/1Panel-dev/1Panel / handleLLMEnv

Function handleLLMEnv

agent/app/service/tensorrt_llm.go:190–209  ·  view source on GitHub ↗
(llm *model.TensorRTLLM, create request.TensorRTLLMCreate)

Source from the content-addressed store, hash-verified

188}
189
190func handleLLMEnv(llm *model.TensorRTLLM, create request.TensorRTLLMCreate) gotenv.Env {
191 envMap := make(gotenv.Env)
192 envMap["CONTAINER_NAME"] = create.ContainerName
193 envMap["MODEL_PATH"] = create.ModelDir
194 envMap["VERSION"] = create.Version
195 envMap["IMAGE"] = create.Image
196 envMap["COMMAND"] = create.Command
197 for i, port := range create.ExposedPorts {
198 containerPortStr := fmt.Sprintf("CONTAINER_PORT_%d", i)
199 hostPortStr := fmt.Sprintf("HOST_PORT_%d", i)
200 hostIPStr := fmt.Sprintf("HOST_IP_%d", i)
201 envMap[containerPortStr] = strconv.Itoa(port.ContainerPort)
202 envMap[hostPortStr] = strconv.Itoa(port.HostPort)
203 envMap[hostIPStr] = port.HostIP
204 }
205 orders := []string{"MODEL_PATH", "COMMAND"}
206 envStr, _ := env.MarshalWithOrder(envMap, orders)
207 llm.Env = envStr
208 return envMap
209}
210
211func (t TensorRTLLMService) Create(create request.TensorRTLLMCreate) error {
212 servers, _ := tensorrtLLMRepo.List()

Callers 2

CreateMethod · 0.85
UpdateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected