MingruiZhang commited on
Commit
9537aed
·
unverified ·
1 Parent(s): abc1963

fix: remove mediaUrl and disallow extra fields (#79)

Browse files
lib/hooks/useVisionAgent.ts CHANGED
@@ -38,7 +38,6 @@ const useVisionAgent = (chat: ChatWithMessages) => {
38
  );
39
  setMessageId(currMessageId.current);
40
  },
41
- sendExtraMessageFields: true,
42
  initialMessages: convertDBMessageToUIMessage(dbMessages),
43
  body: {
44
  mediaUrl: currMediaUrl.current,
@@ -74,8 +73,6 @@ const useVisionAgent = (chat: ChatWithMessages) => {
74
  id,
75
  role: 'user',
76
  content: message.prompt,
77
- // @ts-ignore valid when setting sendExtraMessageFields
78
- mediaUrl: message.mediaUrl,
79
  });
80
  },
81
  reload,
 
38
  );
39
  setMessageId(currMessageId.current);
40
  },
 
41
  initialMessages: convertDBMessageToUIMessage(dbMessages),
42
  body: {
43
  mediaUrl: currMediaUrl.current,
 
73
  id,
74
  role: 'user',
75
  content: message.prompt,
 
 
76
  });
77
  },
78
  reload,
lib/types.ts CHANGED
@@ -8,9 +8,7 @@ export type MessageAssistantResponse = Partial<
8
  Pick<Message, 'response' | 'result'>
9
  >;
10
 
11
- export type MessageUI = Pick<MessageAI, 'role' | 'content' | 'id'> & {
12
- mediaUrl?: string;
13
- };
14
 
15
  export interface SignedPayload {
16
  id: string;
 
8
  Pick<Message, 'response' | 'result'>
9
  >;
10
 
11
+ export type MessageUI = Pick<MessageAI, 'role' | 'content' | 'id'>;
 
 
12
 
13
  export interface SignedPayload {
14
  id: string;
lib/utils/message.ts CHANGED
@@ -16,7 +16,6 @@ export const convertDBMessageToUIMessage = (
16
  id: id + '-user',
17
  role: 'user',
18
  content: prompt,
19
- mediaUrl,
20
  });
21
  }
22
  if (response) {
 
16
  id: id + '-user',
17
  role: 'user',
18
  content: prompt,
 
19
  });
20
  }
21
  if (response) {