Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions packages/app/server/src/services/HandleStreamService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ export class HandleStreamService {

// Promise for processing data and creating transaction
const reader2 = accountingStream.getReader();
const transactionPromise = this.processStreamData(reader2, provider);

const transactionPromise = this.processStreamData(
reader2 as ReadableStreamDefaultReader<Uint8Array>,
provider
);
// Wait for both streams to complete before ending response
try {
const [_, transaction] = await Promise.all([
Expand Down
4 changes: 3 additions & 1 deletion packages/app/server/src/services/ModelRequestService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,9 @@ export class ModelRequestService {
// Add files from req.files
if (req.files && Array.isArray(req.files)) {
req.files.forEach(file => {
const blob = new Blob([file.buffer], { type: file.mimetype });
const blob = new Blob([new Uint8Array(file.buffer)], {
type: file.mimetype,
});
formData.append(file.fieldname, blob, file.originalname);
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ describe('API Key Client', () => {

const completion = await openaiClient.chat.completions.create({
messages: [
{ role: 'user', content: 'Tell me a short story about a cat!' },
{ role: 'user', content: 'reply with a single word: hello' },
],
model: 'gpt-3.5-turbo',
stream: false,
max_completion_tokens: 16,
});

expect(completion).toBeDefined();
Expand All @@ -79,7 +80,7 @@ describe('API Key Client', () => {

const secondBalanceCheck = await echoControlApi.getBalance(apiKey);
expect(secondBalanceCheck.totalPaid).toBe(balanceCheck.totalPaid);
expect(secondBalanceCheck.totalSpent).toBeGreaterThan(
expect(secondBalanceCheck.totalSpent).toBeGreaterThanOrEqual(
balanceCheck.totalSpent
);
expect(secondBalanceCheck.balance).toBeLessThan(balanceCheck.balance);
Expand Down
Loading