Skip to content

Commit d8b6ccb

Browse files
authored
[UI]: Fix curl sample in model code button (#2027)
- Remove trailing comma in JSON object - Handle missing trailing slash in model URL
1 parent 69eb0cf commit d8b6ccb

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

frontend/src/pages/Models/Details/helpers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ response = client.chat.completions.create(
2323
};
2424

2525
export const getCurlModelCode = ({ model, token }: { model?: IModelExtended | null; token?: string }) => {
26-
return `curl ${getModelGateway(model?.base_url ?? '') + 'chat/completions'} \\
26+
const url = getModelGateway(model?.base_url ?? '').replace(/\/$/, '') + '/chat/completions';
27+
return `curl ${url} \\
2728
-H "Content-Type: application/json" \\
2829
-H "Authorization: Bearer ${token}" \\
2930
-d '{
@@ -35,6 +36,6 @@ export const getCurlModelCode = ({ model, token }: { model?: IModelExtended | nu
3536
}
3637
],
3738
"stream": true,
38-
"max_tokens": 512,
39+
"max_tokens": 512
3940
}'`;
4041
};

0 commit comments

Comments
 (0)