Skip to content

Commit 1348ba7

Browse files
committed
Update Angular 20.3.1 & Angular CLI 20.3.2 on frontend-angular
1 parent 3eb971a commit 1348ba7

File tree

5 files changed

+532
-489
lines changed

5 files changed

+532
-489
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Appel d'API en javascript
2+
const response = await axios.post(
3+
'https://api.openai.com/v1/chat/completions',
4+
{
5+
model: 'gpt-4-turbo',
6+
messages: [{ role: 'user', content: prompt }],
7+
},
8+
{
9+
headers: {
10+
Authorization: `Bearer ${process.env.OPENAI_API_KEY}`,
11+
'Content-Type': 'application/json',
12+
},
13+
},
14+
);
15+
console.log('00000000001:' + JSON.stringify(response.data));
16+
return response.data.choices[0].message.content.trim();
17+
18+
# Type de Reponse de ChatGPT
19+
20+
{
21+
"id": "chatcmpl-CJJpGQJ5Bfsk4LkhxHuCk4TxEYoPJ",
22+
"object": "chat.completion",
23+
"created": 1758720478,
24+
"model": "gpt-4-turbo-2024-04-09",
25+
"choices": [
26+
{
27+
"index": 0,
28+
"message": {
29+
"role": "assistant",
30+
"content": "Ridley Scott, né le 30 novembre 1937 à South Shields, Angleterre, est un réalisateur et producteur britannique célèbre pour des films comme \"Alien\", \"Blade Runner\" et \"Gladiator\".",
31+
"refusal": null,
32+
"annotations": []
33+
},
34+
"logprobs": null,
35+
"finish_reason": "stop"
36+
}
37+
],
38+
"usage": {
39+
"prompt_tokens": 43,
40+
"completion_tokens": 52,
41+
"total_tokens": 95,
42+
"prompt_tokens_details": {
43+
"cached_tokens": 0,
44+
"audio_tokens": 0
45+
},
46+
"completion_tokens_details": {
47+
"reasoning_tokens": 0,
48+
"audio_tokens": 0,
49+
"accepted_prediction_tokens": 0,
50+
"rejected_prediction_tokens": 0
51+
}
52+
},
53+
"service_tier": "default",
54+
"system_fingerprint": "fp_de235176ee"
55+
}

frontend-angular-ai/llm-connector/backend-javascript/src/services/llm/chatgpt.service.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async function reply(type, input) {
5353
},
5454
},
5555
);
56-
56+
console.log('00000000001:' + JSON.stringify(response.data));
5757
return response.data.choices[0].message.content.trim();
5858

5959
} catch (error) {

0 commit comments

Comments
 (0)