mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2026-06-12 15:37:27 +01:00
Fixing test issue
This commit is contained in:
@@ -5,9 +5,6 @@ import { getAuthorizationHeader } from "../Utils/AuthorizationUtils";
|
|||||||
|
|
||||||
export class ChatbotClient {
|
export class ChatbotClient {
|
||||||
public async getConversationToken(): Promise<{ conversationId: string; token: string; expires_in: number }> {
|
public async getConversationToken(): Promise<{ conversationId: string; token: string; expires_in: number }> {
|
||||||
if (!userContext.databaseAccount || !userContext.databaseAccount.id) {
|
|
||||||
throw new Error("Database account not set");
|
|
||||||
}
|
|
||||||
const url = `${configContext.JUNO_ENDPOINT}/api/chatbot/bot${userContext.databaseAccount.id}/conversationToken`;
|
const url = `${configContext.JUNO_ENDPOINT}/api/chatbot/bot${userContext.databaseAccount.id}/conversationToken`;
|
||||||
const authorizationHeader = getAuthorizationHeader();
|
const authorizationHeader = getAuthorizationHeader();
|
||||||
const response = await window.fetch(url, {
|
const response = await window.fetch(url, {
|
||||||
|
|||||||
@@ -469,6 +469,10 @@ export default class Explorer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async generateConversationToken() {
|
private async generateConversationToken() {
|
||||||
|
if (userContext.databaseAccount === undefined || !userContext.databaseAccount.id === undefined) {
|
||||||
|
console.error("Database account not set");
|
||||||
|
return;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const tokenResponse = await this.chatbotClient.getConversationToken();
|
const tokenResponse = await this.chatbotClient.getConversationToken();
|
||||||
this.conversationToken(tokenResponse?.token);
|
this.conversationToken(tokenResponse?.token);
|
||||||
|
|||||||
Reference in New Issue
Block a user