@umituz/web-ai-groq-provider 1.1.3 → 1.1.4
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/package.json
CHANGED
|
@@ -8,11 +8,11 @@ import type {
|
|
|
8
8
|
ChatMessage,
|
|
9
9
|
ChatConfig,
|
|
10
10
|
IChatStorage,
|
|
11
|
-
} from "
|
|
11
|
+
} from "../entities";
|
|
12
12
|
import type {
|
|
13
13
|
UseChatOptions,
|
|
14
14
|
UseChatReturn,
|
|
15
|
-
} from "
|
|
15
|
+
} from "../interfaces";
|
|
16
16
|
import { chatService } from "../services/chat.service";
|
|
17
17
|
|
|
18
18
|
const isDevelopment =
|
|
@@ -6,14 +6,14 @@
|
|
|
6
6
|
import type {
|
|
7
7
|
IChatService,
|
|
8
8
|
IMessageFormatter,
|
|
9
|
-
} from "
|
|
9
|
+
} from "../interfaces";
|
|
10
10
|
import type {
|
|
11
11
|
ChatMessage,
|
|
12
12
|
ChatConversation,
|
|
13
13
|
SendMessageInput,
|
|
14
14
|
SendMessageResult,
|
|
15
15
|
ChatConfig,
|
|
16
|
-
} from "
|
|
16
|
+
} from "../entities";
|
|
17
17
|
import { textGenerationService } from "../../groq/services";
|
|
18
18
|
import { messageFormatter } from "../utils/message-formatter";
|
|
19
19
|
|
|
@@ -36,12 +36,12 @@ class ChatService implements IChatService {
|
|
|
36
36
|
}
|
|
37
37
|
|
|
38
38
|
async sendMessage(input: SendMessageInput): Promise<SendMessageResult> {
|
|
39
|
-
// Create user message
|
|
40
|
-
const userMessage =
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
39
|
+
// Create user message with all properties
|
|
40
|
+
const userMessage: ChatMessage = {
|
|
41
|
+
...messageFormatter.toChatMessage(input.text, "user"),
|
|
42
|
+
type: input.type || "text",
|
|
43
|
+
...(input.imageUrl && { imageUrl: input.imageUrl }),
|
|
44
|
+
};
|
|
45
45
|
|
|
46
46
|
// Generate AI response
|
|
47
47
|
const aiResponse = await this.generateAIResponse(
|
|
@@ -101,10 +101,12 @@ class ChatService implements IChatService {
|
|
|
101
101
|
);
|
|
102
102
|
|
|
103
103
|
// Format response as chat message
|
|
104
|
-
const aiMessage =
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
const aiMessage: ChatMessage = {
|
|
105
|
+
...messageFormatter.toChatMessage(response, "assistant"),
|
|
106
|
+
metadata: {
|
|
107
|
+
companionId,
|
|
108
|
+
model: "llama-3.3-70b-versatile",
|
|
109
|
+
},
|
|
108
110
|
};
|
|
109
111
|
|
|
110
112
|
return aiMessage;
|