fix: guard completed API with message id (#23184)
This commit is contained in:
@@ -161,9 +161,12 @@ export const getModels = async (
|
||||
|
||||
type ChatCompletedForm = {
|
||||
model: string;
|
||||
messages: string[];
|
||||
messages: Record<string, unknown>[];
|
||||
chat_id: string;
|
||||
session_id: string;
|
||||
session_id: string | undefined;
|
||||
id: string;
|
||||
filter_ids?: string[];
|
||||
model_item?: unknown;
|
||||
};
|
||||
|
||||
export const chatCompleted = async (token: string, body: ChatCompletedForm) => {
|
||||
|
||||
@@ -1358,6 +1358,11 @@
|
||||
};
|
||||
|
||||
const chatCompletedHandler = async (_chatId, modelId, responseMessageId, messages) => {
|
||||
if (!responseMessageId) {
|
||||
console.error('chatCompleted: missing message id', { chatId: _chatId, modelId, messageCount: messages?.length ?? 0 });
|
||||
return;
|
||||
}
|
||||
|
||||
const res = await chatCompleted(localStorage.token, {
|
||||
model: modelId,
|
||||
messages: messages.map((m) => ({
|
||||
|
||||
Reference in New Issue
Block a user