mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Revert "Convert conversationId int to string before making api request to bulk update file filters"
This reverts commitc9665fb20b
. Revert "Fix handling for new conversation in agents page" This reverts commit3466f04992
. Revert "Add a unique_id field for identifiying conversations (#914)" This reverts commitece2ec2d90
.
This commit is contained in:
parent
bb2bd77a64
commit
0a568244fd
12 changed files with 29 additions and 178 deletions
|
@ -38,7 +38,6 @@ import { getIconFromIconName } from "../common/iconUtils";
|
||||||
import { convertColorToTextClass } from "../common/colorUtils";
|
import { convertColorToTextClass } from "../common/colorUtils";
|
||||||
import { Alert, AlertDescription } from "@/components/ui/alert";
|
import { Alert, AlertDescription } from "@/components/ui/alert";
|
||||||
import { useIsMobileWidth } from "../common/utils";
|
import { useIsMobileWidth } from "../common/utils";
|
||||||
import { createNewConversation } from "../common/chatFunctions";
|
|
||||||
|
|
||||||
export interface AgentData {
|
export interface AgentData {
|
||||||
slug: string;
|
slug: string;
|
||||||
|
@ -56,10 +55,13 @@ async function openChat(slug: string, userData: UserProfile | null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
const response = await fetch(`/api/chat/sessions?agent_slug=${slug}`, { method: "POST" });
|
||||||
const response = await createNewConversation(slug);
|
const data = await response.json();
|
||||||
window.location.href = `/chat?v=${response.conversationUniqueId}`;
|
if (response.status == 200) {
|
||||||
} catch (error) {
|
window.location.href = `/chat?conversationId=${data.conversation_id}`;
|
||||||
|
} else if (response.status == 403 || response.status == 401) {
|
||||||
|
window.location.href = unauthenticatedRedirectUrl;
|
||||||
|
} else {
|
||||||
alert("Failed to start chat session");
|
alert("Failed to start chat session");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,8 +32,7 @@ interface ChatBodyDataProps {
|
||||||
|
|
||||||
function ChatBodyData(props: ChatBodyDataProps) {
|
function ChatBodyData(props: ChatBodyDataProps) {
|
||||||
const searchParams = useSearchParams();
|
const searchParams = useSearchParams();
|
||||||
const conversationUniqueId = searchParams.get("v");
|
const conversationId = searchParams.get("conversationId");
|
||||||
const [conversationId, setConversationId] = useState<string | null>("");
|
|
||||||
const [message, setMessage] = useState("");
|
const [message, setMessage] = useState("");
|
||||||
const [image, setImage] = useState<string | null>(null);
|
const [image, setImage] = useState<string | null>(null);
|
||||||
const [processingMessage, setProcessingMessage] = useState(false);
|
const [processingMessage, setProcessingMessage] = useState(false);
|
||||||
|
@ -61,11 +60,6 @@ function ChatBodyData(props: ChatBodyDataProps) {
|
||||||
setProcessingMessage(true);
|
setProcessingMessage(true);
|
||||||
setQueryToProcess(storedMessage);
|
setQueryToProcess(storedMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
const conversationId = localStorage.getItem("conversationId");
|
|
||||||
if (conversationId) {
|
|
||||||
setConversationId(conversationId);
|
|
||||||
}
|
|
||||||
}, [setQueryToProcess]);
|
}, [setQueryToProcess]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -75,30 +69,6 @@ function ChatBodyData(props: ChatBodyDataProps) {
|
||||||
}
|
}
|
||||||
}, [message, setQueryToProcess]);
|
}, [message, setQueryToProcess]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (!conversationUniqueId) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
fetch(
|
|
||||||
`/api/chat/metadata?conversation_unique_id=${encodeURIComponent(conversationUniqueId)}`,
|
|
||||||
)
|
|
||||||
.then((response) => {
|
|
||||||
if (!response.ok) {
|
|
||||||
throw new Error(response.statusText);
|
|
||||||
}
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then((data) => {
|
|
||||||
setConversationId(data.conversationId);
|
|
||||||
})
|
|
||||||
.catch((err) => {
|
|
||||||
console.error(err);
|
|
||||||
setConversationId(null);
|
|
||||||
return;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (conversationId) {
|
if (conversationId) {
|
||||||
onConversationIdChange?.(conversationId);
|
onConversationIdChange?.(conversationId);
|
||||||
|
@ -117,15 +87,11 @@ function ChatBodyData(props: ChatBodyDataProps) {
|
||||||
}
|
}
|
||||||
}, [props.streamedMessages]);
|
}, [props.streamedMessages]);
|
||||||
|
|
||||||
if (!conversationUniqueId || conversationId === null) {
|
if (!conversationId) {
|
||||||
window.location.href = "/";
|
window.location.href = "/";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!conversationId) {
|
|
||||||
return <Loading />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className={false ? styles.chatBody : styles.chatBodyFull}>
|
<div className={false ? styles.chatBody : styles.chatBodyFull}>
|
||||||
|
|
|
@ -163,7 +163,7 @@ export function modifyFileFilterForConversation(
|
||||||
const method = mode === "add" ? "POST" : "DELETE";
|
const method = mode === "add" ? "POST" : "DELETE";
|
||||||
|
|
||||||
const body = {
|
const body = {
|
||||||
conversation_id: String(conversationId),
|
conversation_id: conversationId,
|
||||||
filenames: filenames,
|
filenames: filenames,
|
||||||
};
|
};
|
||||||
const addUrl = `/api/chat/conversation/file-filters/bulk`;
|
const addUrl = `/api/chat/conversation/file-filters/bulk`;
|
||||||
|
@ -177,6 +177,7 @@ export function modifyFileFilterForConversation(
|
||||||
})
|
})
|
||||||
.then((response) => response.json())
|
.then((response) => response.json())
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
|
console.log("ADDEDFILES DATA: ", data);
|
||||||
setAddedFiles(data);
|
setAddedFiles(data);
|
||||||
})
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
@ -185,11 +186,6 @@ export function modifyFileFilterForConversation(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
interface NewConversationMetadata {
|
|
||||||
conversationId: string;
|
|
||||||
conversationUniqueId: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export async function createNewConversation(slug: string) {
|
export async function createNewConversation(slug: string) {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/api/chat/sessions?client=web&agent_slug=${slug}`, {
|
const response = await fetch(`/api/chat/sessions?client=web&agent_slug=${slug}`, {
|
||||||
|
@ -198,14 +194,9 @@ export async function createNewConversation(slug: string) {
|
||||||
if (!response.ok)
|
if (!response.ok)
|
||||||
throw new Error(`Failed to fetch chat sessions with status: ${response.status}`);
|
throw new Error(`Failed to fetch chat sessions with status: ${response.status}`);
|
||||||
const data = await response.json();
|
const data = await response.json();
|
||||||
const uniqueId = data.unique_id;
|
const conversationID = data.conversation_id;
|
||||||
const conversationId = data.conversation_id;
|
if (!conversationID) throw new Error("Conversation ID not found in response");
|
||||||
if (!uniqueId) throw new Error("Unique ID not found in response");
|
return conversationID;
|
||||||
if (!conversationId) throw new Error("Conversation ID not found in response");
|
|
||||||
return {
|
|
||||||
conversationId: conversationId,
|
|
||||||
conversationUniqueId: uniqueId,
|
|
||||||
} as NewConversationMetadata;
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Error creating new conversation:", error);
|
console.error("Error creating new conversation:", error);
|
||||||
throw error;
|
throw error;
|
||||||
|
|
|
@ -67,9 +67,7 @@ interface ChatHistory {
|
||||||
compressed: boolean;
|
compressed: boolean;
|
||||||
created: string;
|
created: string;
|
||||||
updated: string;
|
updated: string;
|
||||||
unique_id: string;
|
|
||||||
showSidePanel: (isEnabled: boolean) => void;
|
showSidePanel: (isEnabled: boolean) => void;
|
||||||
selectedConversationId: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -400,7 +398,6 @@ interface SessionsAndFilesProps {
|
||||||
conversationId: string | null;
|
conversationId: string | null;
|
||||||
uploadedFiles: string[];
|
uploadedFiles: string[];
|
||||||
isMobileWidth: boolean;
|
isMobileWidth: boolean;
|
||||||
selectedConversationId: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function SessionsAndFiles(props: SessionsAndFilesProps) {
|
function SessionsAndFiles(props: SessionsAndFilesProps) {
|
||||||
|
@ -438,10 +435,6 @@ function SessionsAndFiles(props: SessionsAndFilesProps) {
|
||||||
agent_avatar={chatHistory.agent_avatar}
|
agent_avatar={chatHistory.agent_avatar}
|
||||||
agent_name={chatHistory.agent_name}
|
agent_name={chatHistory.agent_name}
|
||||||
showSidePanel={props.setEnabled}
|
showSidePanel={props.setEnabled}
|
||||||
unique_id={chatHistory.unique_id}
|
|
||||||
selectedConversationId={
|
|
||||||
props.selectedConversationId
|
|
||||||
}
|
|
||||||
/>
|
/>
|
||||||
),
|
),
|
||||||
)}
|
)}
|
||||||
|
@ -453,7 +446,6 @@ function SessionsAndFiles(props: SessionsAndFilesProps) {
|
||||||
<ChatSessionsModal
|
<ChatSessionsModal
|
||||||
data={props.organizedData}
|
data={props.organizedData}
|
||||||
showSidePanel={props.setEnabled}
|
showSidePanel={props.setEnabled}
|
||||||
selectedConversationId={props.selectedConversationId}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
@ -648,18 +640,20 @@ function ChatSessionActionMenu(props: ChatSessionActionMenuProps) {
|
||||||
function ChatSession(props: ChatHistory) {
|
function ChatSession(props: ChatHistory) {
|
||||||
const [isHovered, setIsHovered] = useState(false);
|
const [isHovered, setIsHovered] = useState(false);
|
||||||
const [title, setTitle] = useState(props.slug || "New Conversation 🌱");
|
const [title, setTitle] = useState(props.slug || "New Conversation 🌱");
|
||||||
var currConversationId =
|
var currConversationId = parseInt(
|
||||||
props.conversation_id &&
|
new URLSearchParams(window.location.search).get("conversationId") || "-1",
|
||||||
props.selectedConversationId &&
|
);
|
||||||
parseInt(props.conversation_id) === parseInt(props.selectedConversationId);
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
onMouseEnter={() => setIsHovered(true)}
|
onMouseEnter={() => setIsHovered(true)}
|
||||||
onMouseLeave={() => setIsHovered(false)}
|
onMouseLeave={() => setIsHovered(false)}
|
||||||
key={props.conversation_id}
|
key={props.conversation_id}
|
||||||
className={`${styles.session} ${props.compressed ? styles.compressed : "!max-w-full"} ${isHovered ? `${styles.sessionHover}` : ""} ${currConversationId ? "dark:bg-neutral-800 bg-white" : ""}`}
|
className={`${styles.session} ${props.compressed ? styles.compressed : "!max-w-full"} ${isHovered ? `${styles.sessionHover}` : ""} ${currConversationId === parseInt(props.conversation_id) && currConversationId != -1 ? "dark:bg-neutral-800 bg-white" : ""}`}
|
||||||
>
|
>
|
||||||
<Link href={`/chat?v=${props.unique_id}`} onClick={() => props.showSidePanel(false)}>
|
<Link
|
||||||
|
href={`/chat?conversationId=${props.conversation_id}`}
|
||||||
|
onClick={() => props.showSidePanel(false)}
|
||||||
|
>
|
||||||
<p className={styles.session}>{title}</p>
|
<p className={styles.session}>{title}</p>
|
||||||
</Link>
|
</Link>
|
||||||
<ChatSessionActionMenu conversationId={props.conversation_id} setTitle={setTitle} />
|
<ChatSessionActionMenu conversationId={props.conversation_id} setTitle={setTitle} />
|
||||||
|
@ -670,14 +664,9 @@ function ChatSession(props: ChatHistory) {
|
||||||
interface ChatSessionsModalProps {
|
interface ChatSessionsModalProps {
|
||||||
data: GroupedChatHistory | null;
|
data: GroupedChatHistory | null;
|
||||||
showSidePanel: (isEnabled: boolean) => void;
|
showSidePanel: (isEnabled: boolean) => void;
|
||||||
selectedConversationId: string | null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function ChatSessionsModal({
|
function ChatSessionsModal({ data, showSidePanel }: ChatSessionsModalProps) {
|
||||||
data,
|
|
||||||
showSidePanel,
|
|
||||||
selectedConversationId,
|
|
||||||
}: ChatSessionsModalProps) {
|
|
||||||
return (
|
return (
|
||||||
<Dialog>
|
<Dialog>
|
||||||
<DialogTrigger className="flex text-left text-medium text-gray-500 hover:text-gray-300 cursor-pointer my-4 text-sm p-[0.5rem]">
|
<DialogTrigger className="flex text-left text-medium text-gray-500 hover:text-gray-300 cursor-pointer my-4 text-sm p-[0.5rem]">
|
||||||
|
@ -709,8 +698,6 @@ function ChatSessionsModal({
|
||||||
agent_avatar={chatHistory.agent_avatar}
|
agent_avatar={chatHistory.agent_avatar}
|
||||||
agent_name={chatHistory.agent_name}
|
agent_name={chatHistory.agent_name}
|
||||||
showSidePanel={showSidePanel}
|
showSidePanel={showSidePanel}
|
||||||
unique_id={chatHistory.unique_id}
|
|
||||||
selectedConversationId={selectedConversationId}
|
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
@ -832,7 +819,6 @@ export default function SidePanel(props: SidePanelProps) {
|
||||||
userProfile={authenticatedData}
|
userProfile={authenticatedData}
|
||||||
conversationId={props.conversationId}
|
conversationId={props.conversationId}
|
||||||
isMobileWidth={props.isMobileWidth}
|
isMobileWidth={props.isMobileWidth}
|
||||||
selectedConversationId={props.conversationId}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
|
@ -901,7 +887,6 @@ export default function SidePanel(props: SidePanelProps) {
|
||||||
userProfile={authenticatedData}
|
userProfile={authenticatedData}
|
||||||
conversationId={props.conversationId}
|
conversationId={props.conversationId}
|
||||||
isMobileWidth={props.isMobileWidth}
|
isMobileWidth={props.isMobileWidth}
|
||||||
selectedConversationId={props.conversationId}
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -408,7 +408,7 @@ export const suggestionsData: Suggestion[] = [
|
||||||
link: "",
|
link: "",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
type: SuggestionType.Interviewing,
|
type: SuggestionType.Code,
|
||||||
color: suggestionToColorMap[SuggestionType.Interviewing] || DEFAULT_COLOR,
|
color: suggestionToColorMap[SuggestionType.Interviewing] || DEFAULT_COLOR,
|
||||||
description: "Provide tips for writing an effective resume.",
|
description: "Provide tips for writing an effective resume.",
|
||||||
link: "",
|
link: "",
|
||||||
|
|
|
@ -147,13 +147,10 @@ function ChatBodyData(props: ChatBodyDataProps) {
|
||||||
if (message && !processingMessage) {
|
if (message && !processingMessage) {
|
||||||
setProcessingMessage(true);
|
setProcessingMessage(true);
|
||||||
try {
|
try {
|
||||||
const newConversationMetadata = await createNewConversation(
|
const newConversationId = await createNewConversation(selectedAgent || "khoj");
|
||||||
selectedAgent || "khoj",
|
onConversationIdChange?.(newConversationId);
|
||||||
);
|
window.location.href = `/chat?conversationId=${newConversationId}`;
|
||||||
onConversationIdChange?.(newConversationMetadata.conversationId);
|
|
||||||
window.location.href = `/chat?v=${newConversationMetadata.conversationUniqueId}`;
|
|
||||||
localStorage.setItem("message", message);
|
localStorage.setItem("message", message);
|
||||||
localStorage.setItem("conversationId", newConversationMetadata.conversationId);
|
|
||||||
if (image) {
|
if (image) {
|
||||||
localStorage.setItem("image", image);
|
localStorage.setItem("image", image);
|
||||||
}
|
}
|
||||||
|
|
|
@ -679,10 +679,6 @@ class ConversationAdapters:
|
||||||
|
|
||||||
return conversation
|
return conversation
|
||||||
|
|
||||||
@staticmethod
|
|
||||||
def get_conversation_by_unique_id(user: KhojUser, unique_id: str):
|
|
||||||
return Conversation.objects.filter(unique_id=unique_id, user=user).first()
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def get_conversation_sessions(user: KhojUser, client_application: ClientApplication = None):
|
def get_conversation_sessions(user: KhojUser, client_application: ClientApplication = None):
|
||||||
return (
|
return (
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
# Generated by Django 5.0.8 on 2024-09-16 04:12
|
|
||||||
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
dependencies = [
|
|
||||||
("database", "0062_merge_20240913_0222"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name="conversation",
|
|
||||||
name="unique_id",
|
|
||||||
field=models.UUIDField(default=None, editable=False, null=True),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,20 +0,0 @@
|
||||||
import uuid
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
def populate_unique_id(apps, schema_editor):
|
|
||||||
Conversation = apps.get_model("database", "Conversation")
|
|
||||||
for conversation in Conversation.objects.all():
|
|
||||||
conversation.unique_id = uuid.uuid4()
|
|
||||||
conversation.save()
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
dependencies = [
|
|
||||||
("database", "0063_conversation_add_unique_id_field"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RunPython(populate_unique_id),
|
|
||||||
]
|
|
|
@ -1,17 +0,0 @@
|
||||||
import uuid
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
dependencies = [
|
|
||||||
("database", "0064_populate_unique_id"),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name="conversation",
|
|
||||||
name="unique_id",
|
|
||||||
field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -350,7 +350,6 @@ class Conversation(BaseModel):
|
||||||
title = models.CharField(max_length=200, default=None, null=True, blank=True)
|
title = models.CharField(max_length=200, default=None, null=True, blank=True)
|
||||||
agent = models.ForeignKey(Agent, on_delete=models.SET_NULL, default=None, null=True, blank=True)
|
agent = models.ForeignKey(Agent, on_delete=models.SET_NULL, default=None, null=True, blank=True)
|
||||||
file_filters = models.JSONField(default=list)
|
file_filters = models.JSONField(default=list)
|
||||||
unique_id = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
|
|
||||||
|
|
||||||
|
|
||||||
class PublicConversation(BaseModel):
|
class PublicConversation(BaseModel):
|
||||||
|
|
|
@ -224,7 +224,6 @@ def chat_history(
|
||||||
"conversation_id": conversation.id,
|
"conversation_id": conversation.id,
|
||||||
"slug": conversation.title if conversation.title else conversation.slug,
|
"slug": conversation.title if conversation.title else conversation.slug,
|
||||||
"agent": agent_metadata,
|
"agent": agent_metadata,
|
||||||
"unique_id": conversation.unique_id,
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -246,33 +245,6 @@ def chat_history(
|
||||||
return {"status": "ok", "response": meta_log}
|
return {"status": "ok", "response": meta_log}
|
||||||
|
|
||||||
|
|
||||||
@api_chat.get("/metadata")
|
|
||||||
def get_chat_metadata(
|
|
||||||
request: Request,
|
|
||||||
common: CommonQueryParams,
|
|
||||||
conversation_unique_id: str,
|
|
||||||
):
|
|
||||||
user = request.user.object
|
|
||||||
|
|
||||||
# Load Conversation Metadata
|
|
||||||
conversation = ConversationAdapters.get_conversation_by_unique_id(user, conversation_unique_id)
|
|
||||||
|
|
||||||
if conversation is None:
|
|
||||||
return Response(
|
|
||||||
content=json.dumps({"status": "error", "message": f"Conversation: {conversation_unique_id} not found"}),
|
|
||||||
status_code=404,
|
|
||||||
)
|
|
||||||
|
|
||||||
update_telemetry_state(
|
|
||||||
request=request,
|
|
||||||
telemetry_type="api",
|
|
||||||
api="chat_metadata",
|
|
||||||
**common.__dict__,
|
|
||||||
)
|
|
||||||
|
|
||||||
return {"status": "ok", "conversationId": conversation.id}
|
|
||||||
|
|
||||||
|
|
||||||
@api_chat.get("/share/history")
|
@api_chat.get("/share/history")
|
||||||
def get_shared_chat(
|
def get_shared_chat(
|
||||||
request: Request,
|
request: Request,
|
||||||
|
@ -446,7 +418,7 @@ def chat_sessions(
|
||||||
conversations = conversations[:8]
|
conversations = conversations[:8]
|
||||||
|
|
||||||
sessions = conversations.values_list(
|
sessions = conversations.values_list(
|
||||||
"id", "slug", "title", "agent__slug", "agent__name", "agent__avatar", "created_at", "updated_at", "unique_id"
|
"id", "slug", "title", "agent__slug", "agent__name", "agent__avatar", "created_at", "updated_at"
|
||||||
)
|
)
|
||||||
|
|
||||||
session_values = [
|
session_values = [
|
||||||
|
@ -457,7 +429,6 @@ def chat_sessions(
|
||||||
"agent_avatar": session[5],
|
"agent_avatar": session[5],
|
||||||
"created": session[6].strftime("%Y-%m-%d %H:%M:%S"),
|
"created": session[6].strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
"updated": session[7].strftime("%Y-%m-%d %H:%M:%S"),
|
"updated": session[7].strftime("%Y-%m-%d %H:%M:%S"),
|
||||||
"unique_id": str(session[8]),
|
|
||||||
}
|
}
|
||||||
for session in sessions
|
for session in sessions
|
||||||
]
|
]
|
||||||
|
@ -484,7 +455,7 @@ async def create_chat_session(
|
||||||
# Create new Conversation Session
|
# Create new Conversation Session
|
||||||
conversation = await ConversationAdapters.acreate_conversation_session(user, request.user.client_app, agent_slug)
|
conversation = await ConversationAdapters.acreate_conversation_session(user, request.user.client_app, agent_slug)
|
||||||
|
|
||||||
response = {"conversation_id": conversation.id, "unique_id": str(conversation.unique_id)}
|
response = {"conversation_id": conversation.id}
|
||||||
|
|
||||||
conversation_metadata = {
|
conversation_metadata = {
|
||||||
"agent": agent_slug,
|
"agent": agent_slug,
|
||||||
|
|
Loading…
Add table
Reference in a new issue