Skip to content

Commit 3380fba

Browse files
Jordan/x defang llm warning (#1080)
* warn about x-defang-llm usage in playground * automatically write port 80 for managed llm service
1 parent 5144426 commit 3380fba

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/pkg/cli/compose/fixup.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,19 @@ func FixupServices(ctx context.Context, provider client.Provider, project *types
156156
}
157157
}
158158

159+
_, llm := svccfg.Extensions["x-defang-llm"]
160+
if llm {
161+
if _, ok := provider.(*client.PlaygroundProvider); ok {
162+
term.Warnf("service %q: managed LLM is not supported in the Playground; consider using BYOC (https://s.defang.io/byoc)", svccfg.Name)
163+
delete(svccfg.Extensions, "x-defang-llm")
164+
} else {
165+
// HACK: we must have at least one host port to get a CNAME for the service
166+
var port uint32 = 80
167+
term.Debugf("service %q: adding LLM host port %d", svccfg.Name, port)
168+
svccfg.Ports = []types.ServicePortConfig{{Target: port, Mode: Mode_HOST, Protocol: Protocol_TCP}}
169+
}
170+
}
171+
159172
if !redis && !postgres && isStatefulImage(svccfg.Image) {
160173
term.Warnf("service %q: stateful service will lose data on restart; use a managed service instead", svccfg.Name)
161174
}

0 commit comments

Comments
 (0)