@ai-sdk/angular 3.0.0-canary.159 → 3.0.0-canary.160
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +16 -3
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -493,7 +493,14 @@ AI Gateway as the default provider, so no provider import is required.
|
|
|
493
493
|
### Express.js Chat Endpoint
|
|
494
494
|
|
|
495
495
|
```typescript
|
|
496
|
-
import {
|
|
496
|
+
import {
|
|
497
|
+
convertToModelMessages,
|
|
498
|
+
pipeTextStreamToResponse,
|
|
499
|
+
pipeUIMessageStreamToResponse,
|
|
500
|
+
streamText,
|
|
501
|
+
toTextStream,
|
|
502
|
+
toUIMessageStream,
|
|
503
|
+
} from 'ai';
|
|
497
504
|
import express from 'express';
|
|
498
505
|
|
|
499
506
|
const app = express();
|
|
@@ -507,7 +514,10 @@ app.post('/api/chat', async (req, res) => {
|
|
|
507
514
|
messages: convertToModelMessages(messages),
|
|
508
515
|
});
|
|
509
516
|
|
|
510
|
-
|
|
517
|
+
pipeUIMessageStreamToResponse({
|
|
518
|
+
response: res,
|
|
519
|
+
stream: toUIMessageStream({ stream: result.stream }),
|
|
520
|
+
});
|
|
511
521
|
});
|
|
512
522
|
```
|
|
513
523
|
|
|
@@ -522,7 +532,10 @@ app.post('/api/completion', async (req, res) => {
|
|
|
522
532
|
prompt,
|
|
523
533
|
});
|
|
524
534
|
|
|
525
|
-
|
|
535
|
+
pipeTextStreamToResponse({
|
|
536
|
+
response: res,
|
|
537
|
+
stream: toTextStream({ stream: result.stream }),
|
|
538
|
+
});
|
|
526
539
|
});
|
|
527
540
|
```
|
|
528
541
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ai-sdk/angular",
|
|
3
|
-
"version": "3.0.0-canary.
|
|
3
|
+
"version": "3.0.0-canary.160",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Angular implementation of ai-sdk.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@ai-sdk/provider-utils": "5.0.0-canary.44",
|
|
29
|
-
"ai": "7.0.0-canary.
|
|
29
|
+
"ai": "7.0.0-canary.160"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "22.19.19",
|