refac
This commit is contained in:
1 parent
4e869011cd
commit
1e88367cc8
2 files changed
+12
-2
No files matched your search
@@ -1259,6 +1259,8 @@ async def update_chat_by_id(
|
|||||||
)
|
)
|
||||||
|
|
||||||
chat = await Chats.update_chat_by_id(id, updated_chat, db=db)
|
chat = await Chats.update_chat_by_id(id, updated_chat, db=db)
|
||||||
|
if form_data.variables is not None:
|
||||||
|
chat = await Chats.update_chat_variables_by_id(id, form_data.variables, db=db) or chat
|
||||||
|
|
||||||
# Reconcile chat_message rows without inferring deletes from missing IDs.
|
# Reconcile chat_message rows without inferring deletes from missing IDs.
|
||||||
# Message deletion has its own endpoint below.
|
# Message deletion has its own endpoint below.
|
||||||
@@ -1642,6 +1644,9 @@ async def fork_chat_by_id(
|
|||||||
internal_meta=meta,
|
internal_meta=meta,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if fork and chat.variables:
|
||||||
|
fork = await Chats.update_chat_variables_by_id(fork.id, chat.variables, db=db, touch=False) or fork
|
||||||
|
|
||||||
if not fork:
|
if not fork:
|
||||||
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=ERROR_MESSAGES.DEFAULT())
|
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR, detail=ERROR_MESSAGES.DEFAULT())
|
||||||
|
|
||||||
@@ -1684,6 +1689,7 @@ async def clone_chat_by_id(
|
|||||||
**{
|
**{
|
||||||
'chat': updated_chat,
|
'chat': updated_chat,
|
||||||
'meta': chat.meta,
|
'meta': chat.meta,
|
||||||
|
'variables': chat.variables or {},
|
||||||
'pinned': chat.pinned,
|
'pinned': chat.pinned,
|
||||||
'folder_id': chat.folder_id,
|
'folder_id': chat.folder_id,
|
||||||
}
|
}
|
||||||
@@ -1767,6 +1773,7 @@ async def clone_shared_chat_by_id(
|
|||||||
**{
|
**{
|
||||||
'chat': updated_chat,
|
'chat': updated_chat,
|
||||||
'meta': chat.meta,
|
'meta': chat.meta,
|
||||||
|
'variables': chat.variables or {},
|
||||||
'pinned': chat.pinned,
|
'pinned': chat.pinned,
|
||||||
'folder_id': chat.folder_id,
|
'folder_id': chat.folder_id,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@
|
|||||||
|
|
||||||
export let show = false;
|
export let show = false;
|
||||||
export let variables = {};
|
export let variables = {};
|
||||||
|
export let title = $i18n.t('Input Variables');
|
||||||
|
|
||||||
export let onSave = (e) => {};
|
export let onSave = (e) => {};
|
||||||
|
|
||||||
@@ -67,7 +68,9 @@
|
|||||||
<Modal bind:show size="md">
|
<Modal bind:show size="md">
|
||||||
<div>
|
<div>
|
||||||
<div class=" flex justify-between dark:text-gray-300 px-4 pt-3 pb-1">
|
<div class=" flex justify-between dark:text-gray-300 px-4 pt-3 pb-1">
|
||||||
<div class=" text-sm font-medium self-center">{$i18n.t('Input Variables')}</div>
|
<div class=" text-sm font-medium self-center">
|
||||||
|
{title}
|
||||||
|
</div>
|
||||||
<button
|
<button
|
||||||
class="self-center rounded-lg p-1 text-gray-500 transition hover:bg-gray-50 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"
|
class="self-center rounded-lg p-1 text-gray-500 transition hover:bg-gray-50 hover:text-gray-700 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-gray-200"
|
||||||
on:click={() => {
|
on:click={() => {
|
||||||
@@ -78,7 +81,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="flex flex-col md:flex-row w-full px-5 pb-4 md:space-x-4 dark:text-gray-200">
|
<div class="flex flex-col md:flex-row w-full px-4 pb-4 md:space-x-4 dark:text-gray-200">
|
||||||
<div class=" flex flex-col w-full sm:flex-row sm:justify-center sm:space-x-6">
|
<div class=" flex flex-col w-full sm:flex-row sm:justify-center sm:space-x-6">
|
||||||
<form
|
<form
|
||||||
class="flex flex-col w-full"
|
class="flex flex-col w-full"
|
||||||
|
|||||||
Reference in new issue
Block a user