fix(agent): reject padded assistant model ids
This commit is contained in:
@@ -14,7 +14,6 @@ export const clientChatMessageSchema = z.object({
|
||||
|
||||
export const clientChatModelSchema = z
|
||||
.string()
|
||||
.trim()
|
||||
.refine((value) => isValidLlmModelId(value), "Invalid assistant model");
|
||||
|
||||
export const clientChatInputSchema = z.object({
|
||||
|
||||
@@ -43,4 +43,13 @@ describe("clientChatInputSchema", () => {
|
||||
|
||||
assert.equal(parsed.success, false);
|
||||
});
|
||||
|
||||
it("rejects whitespace-padded model IDs", () => {
|
||||
const parsed = clientChatInputSchema.safeParse({
|
||||
model: " qwen2.5-coder ",
|
||||
messages: [{ role: "user", content: "hello" }],
|
||||
});
|
||||
|
||||
assert.equal(parsed.success, false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user