This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
from langchain.agents import initialize_agent | |
from langchain.llms import OpenAI | |
import json | |
from langchain.agents import Tool | |
from flask import Flask | |
from flask_cors import CORS | |
from flask import * | |
import json, time |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//This action is called by the Power Automate | |
[HttpPost] | |
[Route("postReview")] | |
public async Task<IActionResult> PostReview(string activityId, string botId, string conversationId, string serviceUrl, string userId, string channelId, string botName) | |
{ | |
var convRef = new ConversationReference(); | |
//Revive the conversation reference | |
convRef.ActivityId = activityId; | |
convRef.Bot = new ChannelAccount { Id = botId, Name = botName }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Invoked when a conversation update activity is received from the external Azure Bot Service channel | |
// Start a Power Virtual Agents bot conversation and store the mapping | |
protected override async Task OnConversationUpdateActivityAsync(ITurnContext<IConversationUpdateActivity> turnContext, CancellationToken cancellationToken) | |
{ | |
AddConversationReference(turnContext.Activity as Bot.Schema.Activity); | |
await s_conversationManager.GetOrCreateBotConversationAsync(turnContext.Activity.Conversation.Id, _botService); | |
} | |
private void AddConversationReference(Bot.Schema.Activity activity) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
styleOptions: { | |
backgroundColor: 'rgba(255, 255, 255, .8)', | |
bubbleBackground: 'rgba(0, 0, 255, .1)', | |
bubbleFromUserBackground: 'rgba(0, 255, 0, .1)' | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script> | |
<style> | |
html, | |
body { | |
height: 100%; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script> | |
<style> | |
html, | |
body { | |
height: 100%; | |
} | |
body { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"modelId": "9f0fb19d-bb84-4c04-a273-b2bf9669cbc0", | |
"trainingDocuments": [ | |
{ | |
"documentName": "Registration Application1.pdf", | |
"pages": 1, | |
"errors": [], | |
"status": "success" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
renderWebchat(); | |
async function renderWebchat() | |
{ | |
const store = window.WebChat.createStore({}, ({ dispatch }) => next => action => { | |
if (action.type === 'DIRECT_LINE/CONNECT_FULFILLED') { | |
dispatch({ | |
type: 'WEB_CHAT/SEND_EVENT', | |
payload: { | |
name: 'webchat/join', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="webchat" role="main"></div> | |
<script src="jso.js"></script> | |
<script src="https://cdn.botframework.com/botframework-webchat/latest/webchat.js"></script> | |
{% if user %} | |
<script> | |
var config = { | |
client_id: "b31-aced-b61e18a4f68a", //The client id that was generated when registering the bot app in AD. | |
redirect_uri: "<portal_url>", //Your portal home page url | |
authorization: "<portal_url>/_services/auth/authorize", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using(var httpClient = new HttpClient()) | |
{ | |
// Set headers | |
httpClient.Timeout = new TimeSpan(0, 2, 0); // 2 minutes | |
httpClient.BaseAddress = new Uri(_serviceUrl); | |
httpClient.DefaultRequestHeaders.Add("OData-MaxVersion", "4.0"); | |
httpClient.DefaultRequestHeaders.Accept.Add( | |
new MediaTypeWithQualityHeaderValue("application/json")); | |
// Use the bearer token here | |
httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", tokenResponse.Token); |
NewerOlder