mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-03 21:29:08 +00:00
Add a unique_id field for identifiying conversations (#914)
* Add a unique_id field to the conversation object - This helps us keep track of the unique identity of the conversation without expose the internal id - Create three staged migrations in order to first add the field, then add unique values to pre-fill, and then set the unique constraint. Without this, it tries to initialize all the existing conversations with the same ID. * Parse and utilize the unique_id field in the query parameters of the front-end view - Handle the unique_id field when creating a new conversation from the home page - Parse the id field with a lightweight parameter called v in the chat page - Share page should not be affected, as it uses the public slug * Fix suggested card category
This commit is contained in:
@@ -138,10 +138,13 @@ function ChatBodyData(props: ChatBodyDataProps) {
|
||||
if (message && !processingMessage) {
|
||||
setProcessingMessage(true);
|
||||
try {
|
||||
const newConversationId = await createNewConversation(selectedAgent || "khoj");
|
||||
onConversationIdChange?.(newConversationId);
|
||||
window.location.href = `/chat?conversationId=${newConversationId}`;
|
||||
const newConversationMetadata = await createNewConversation(
|
||||
selectedAgent || "khoj",
|
||||
);
|
||||
onConversationIdChange?.(newConversationMetadata.conversationId);
|
||||
window.location.href = `/chat?v=${newConversationMetadata.conversationUniqueId}`;
|
||||
localStorage.setItem("message", message);
|
||||
localStorage.setItem("conversationId", newConversationMetadata.conversationId);
|
||||
if (image) {
|
||||
localStorage.setItem("image", image);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user