Skip to content

Commit

Permalink
add web search skill to investments endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
thegovind committed May 1, 2023
1 parent b87f992 commit 6f65a16
Show file tree
Hide file tree
Showing 11 changed files with 23,409 additions and 4,745 deletions.
18,170 changes: 18,170 additions & 0 deletions services/frontend/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion services/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
"classnames": "^2.3.2",
"date-fns": "^2.29.3",
"dayjs": "^1.11.7",
"ethers": "^6.3.0",
"framer-motion": "^10.12.2",
"jotai": "^2.0.4",
"js-cookie": "^3.0.1",
Expand Down Expand Up @@ -61,6 +60,7 @@
"@types/react-table": "^7.7.14",
"@types/uuid": "^8.3.4",
"autoprefixer": "^10.4.14",
"depcheck": "^1.4.3",
"eslint": "8.37.0",
"eslint-config-next": "13.2.4",
"eslint-config-prettier": "^8.8.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ import {LinkAccounts} from "@/components/personalize/selectors/link-accounts";
function B2CLogin() {

return (
<div className="px-6 pt-8 flex flex-col items-center">

<div className="px-6 pt-8 flex flex-col items-center cursor-pointer">
<Image src={MicrosoftSignInBtn} alt="Login with Microsoft AAD B2C" width={200}/>
</div>

Expand Down
8 changes: 4 additions & 4 deletions services/frontend/src/data/static/personalize.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
export const subreddits = [
{id: 1, name: 'personalfinance'},
{id: 2, name: 'financialplanning'},
{id: 3, name: 'retirement'},
{id: 4, name: 'economics'},
{id: 5, name: 'frugal'},
{id: 2, name: 'wallstreetbets'},
{id: 3, name: 'ValueInvesting'},
{id: 4, name: 'investing'},
{id: 5, name: '💎🙌Superstonk🚀🦍'},
];
export const riskLevels = [
{id: 1, name: 'Moderate'},
Expand Down
4 changes: 0 additions & 4 deletions services/frontend/src/layouts/_root-layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,8 @@ export default function RootLayout({
const isMounted = useIsMounted();
const { layout } = useLayout();

console.log('layout', layout);

// fix the `Hydration failed because the initial UI does not match` issue
if (!isMounted) return null;


// render modern layout
if (layout === LAYOUT_OPTIONS.MODERN) {
return (
Expand Down
2 changes: 1 addition & 1 deletion services/frontend/src/layouts/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function Header({ className }: { className?: string }) {
<SearchButton
variant="transparent"
className="ltr:-ml-[17px] rtl:-mr-[17px] dark:text-white"
/> Semantic Search
/> Semantic Search, Powered by Azure Cognitive Search
</div>
<HeaderRightArea />
</div>
Expand Down
2 changes: 1 addition & 1 deletion services/frontend/src/layouts/sidebar/left-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function Sidebar({ className }: { className?: string }) {
</div>
<div className="relative mt-20 hidden flex-col rounded-lg bg-gray-200 p-6 dark:bg-[#333E59] lg:flex">
<div className="-mt-16">
<Image src={ShapeImage} alt="Shape image" width={200} />
<Image src={ShapeImage} alt="Shape image" width={200} height={200}/>
</div>
<h2 className="mt-5 mb-7 text-center text-[20px] font-semibold leading-8 text-light-dark dark:text-white">
Intelligent app workshop
Expand Down
1 change: 0 additions & 1 deletion services/frontend/src/lib/hooks/use-layout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ const miyagiLayoutAtom = atom(
const miyagiLayoutAtomWithPersistence = atom(
(get) => get(miyagiLayoutAtom),
(get, set, newStorage: any) => {
console.log('newStorage', typeof window)
set(miyagiLayoutAtom, newStorage);
localStorage.setItem('miyagi-layout', newStorage);
}
Expand Down
9,944 changes: 5,215 additions & 4,729 deletions services/frontend/yarn.lock

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
using Microsoft.SemanticKernel.Orchestration;
using System.Text.Json;
using GBB.Miyagi.RecommendationService.Skills;
using GBB.Miyagi.RecommendationService.Utils;
using Microsoft.SemanticKernel.Skills.Web;
using Microsoft.SemanticKernel.Skills.Web.Bing;

namespace GBB.Miyagi.RecommendationService.Controllers
{
Expand All @@ -13,10 +16,12 @@ namespace GBB.Miyagi.RecommendationService.Controllers
public class InvestmentsController : ControllerBase
{
private readonly IKernel _kernel;
private readonly WebSearchEngineSkill _webSearchEngineSkill;

public InvestmentsController(IKernel kernel)
public InvestmentsController(IKernel kernel, WebSearchEngineSkill webSearchEngineSkill)
{
_kernel = kernel;
_webSearchEngineSkill = webSearchEngineSkill;
}

[HttpPost("/investments")]
Expand Down Expand Up @@ -45,6 +50,15 @@ public async Task<IActionResult> GetRecommendations([FromBody] MiyagiContext miy

var output = result.Result.Replace("\n", "");

// TODO: Load Bing News Search Skill.
var search = _kernel.ImportSkill(_webSearchEngineSkill, "bing");

var bingResult = await _kernel.RunAsync(
"MSFT news",
search["SearchAsync"]
);
_kernel.Log.LogDebug("Bing result: {0}", bingResult.Result);

return Content(output, "application/json");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public RecommendationsController(IKernel kernel,
_webSearchEngineSkill = webSearchEngineSkill;
_blobServiceClient = blobServiceClient;
_assetsController = new AssetsController(kernel);
_investmentsController = new InvestmentsController(kernel);
_investmentsController = new InvestmentsController(kernel, webSearchEngineSkill);
}


Expand Down

0 comments on commit 6f65a16

Please sign in to comment.