You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"Given the following conversation, relevant context, and a follow up question, reply with an answer to the current question the user is asking. Return only your response to the question given the above information following the users instructions as needed.",
137
+
content: [
138
+
{
139
+
type: "text",
140
+
text:
141
+
chat.workspace?.openAiPrompt||
142
+
"Given the following conversation, relevant context, and a follow up question, reply with an answer to the current question the user is asking. Return only your response to the question given the above information following the users instructions as needed.",
143
+
},
144
+
],
132
145
},
133
146
],
134
147
};
135
148
}
136
149
150
+
constuserContent=[
151
+
{
152
+
type: "text",
153
+
text: prompt,
154
+
},
155
+
];
156
+
157
+
if(attachments.length>0){
158
+
attachments.forEach((attachment)=>{
159
+
userContent.push({
160
+
type: "image",
161
+
image: attachmentToDataUrl(attachment),
162
+
});
163
+
});
164
+
}
165
+
137
166
acc[workspaceId].messages.push(
138
167
{
139
168
role: "user",
140
-
content: prompt,
169
+
content: userContent,
141
170
},
142
171
{
143
172
role: "assistant",
144
-
content: responseJson.text,
173
+
content: [
174
+
{
175
+
type: "text",
176
+
text: responseJson.text,
177
+
},
178
+
],
145
179
}
146
180
);
147
181
@@ -203,6 +237,17 @@ function buildSystemPrompt(chat, prompt = null) {
203
237
return`${prompt??STANDARD_PROMPT}${context}`;
204
238
}
205
239
240
+
/**
241
+
* Converts an attachment's content string to a proper data URL format if needed
242
+
* @param {Object} attachment - The attachment object containing contentString and mime type
243
+
* @returns {string} The properly formatted data URL
0 commit comments