forked from open-webui/open-webui
dev #1
2 changed files with 12 additions and 5 deletions
|
@ -308,7 +308,7 @@
|
||||||
.map((file) => file.url.slice(file.url.indexOf(',') + 1));
|
.map((file) => file.url.slice(file.url.indexOf(',') + 1));
|
||||||
|
|
||||||
// Add images array only if it contains elements
|
// Add images array only if it contains elements
|
||||||
if (imageUrls && imageUrls.length > 0) {
|
if (imageUrls && imageUrls.length > 0 && message.role === 'user') {
|
||||||
baseMessage.images = imageUrls;
|
baseMessage.images = imageUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -532,7 +532,8 @@
|
||||||
.filter((message) => message)
|
.filter((message) => message)
|
||||||
.map((message, idx, arr) => ({
|
.map((message, idx, arr) => ({
|
||||||
role: message.role,
|
role: message.role,
|
||||||
...(message.files?.filter((file) => file.type === 'image').length > 0 ?? false
|
...((message.files?.filter((file) => file.type === 'image').length > 0 ?? false) &&
|
||||||
|
message.role === 'user'
|
||||||
? {
|
? {
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
|
|
|
@ -321,7 +321,7 @@
|
||||||
.map((file) => file.url.slice(file.url.indexOf(',') + 1));
|
.map((file) => file.url.slice(file.url.indexOf(',') + 1));
|
||||||
|
|
||||||
// Add images array only if it contains elements
|
// Add images array only if it contains elements
|
||||||
if (imageUrls && imageUrls.length > 0) {
|
if (imageUrls && imageUrls.length > 0 && message.role === 'user') {
|
||||||
baseMessage.images = imageUrls;
|
baseMessage.images = imageUrls;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -545,7 +545,8 @@
|
||||||
.filter((message) => message)
|
.filter((message) => message)
|
||||||
.map((message, idx, arr) => ({
|
.map((message, idx, arr) => ({
|
||||||
role: message.role,
|
role: message.role,
|
||||||
...(message.files?.filter((file) => file.type === 'image').length > 0 ?? false
|
...((message.files?.filter((file) => file.type === 'image').length > 0 ?? false) &&
|
||||||
|
message.role === 'user'
|
||||||
? {
|
? {
|
||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
|
@ -688,8 +689,13 @@
|
||||||
|
|
||||||
if (messages.length == 2) {
|
if (messages.length == 2) {
|
||||||
window.history.replaceState(history.state, '', `/c/${_chatId}`);
|
window.history.replaceState(history.state, '', `/c/${_chatId}`);
|
||||||
|
|
||||||
|
if ($settings?.titleAutoGenerateModel) {
|
||||||
|
await generateChatTitle(_chatId, userPrompt);
|
||||||
|
} else {
|
||||||
await setChatTitle(_chatId, userPrompt);
|
await setChatTitle(_chatId, userPrompt);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const stopResponse = () => {
|
const stopResponse = () => {
|
||||||
|
|
Loading…
Reference in a new issue