Skip to content

Commit ef14c83

Browse files
authored
Merge pull request #4 from pavsingh7/beta-release-rework
Beta release rework. Added new feature. Disregarded translation feature from main.
2 parents 8caa5bf + 6000a61 commit ef14c83

40 files changed

+96
-16
lines changed

app/frontend/src/components/Example/ExampleList.tsx

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
1+
import { useEffect, useState } from "react";
12
import { Example } from "./Example";
2-
import { useTranslation } from "react-i18next";
3+
import { DEFAULT_EXAMPLES, GPT4V_EXAMPLES } from "../../i18n/examples.js";
34

45
import styles from "./Example.module.css";
56

6-
const DEFAULT_EXAMPLES: string[] = [
7-
"What is Sanlam's IT Strategy?",
8-
"How was Retail Affluent's performance in 2023?",
9-
"What savings products does Sanlam sell?"
10-
];
11-
12-
const GPT4V_EXAMPLES: string[] = [
13-
"Compare the impact of interest rates and GDP in financial markets.",
14-
"What is the expected trend for the S&P 500 index over the next five years? Compare it to the past S&P 500 performance",
15-
"Can you identify any correlation between oil prices and stock market trends?"
16-
];
7+
// const DEFAULT_EXAMPLES: string[] = [
8+
// "What is Sanlam's IT Strategy?",
9+
// "How was Retail Affluent's performance in 2023?",
10+
// "What savings products does Sanlam sell?"
11+
// ];
12+
13+
// const GPT4V_EXAMPLES: string[] = [
14+
// "Compare the impact of interest rates and GDP in financial markets.",
15+
// "What is the expected trend for the S&P 500 index over the next five years? Compare it to the past S&P 500 performance",
16+
// "Can you identify any correlation between oil prices and stock market trends?"
17+
// ];
18+
19+
const shuffleArray = (array: string[]) => {
20+
for (let i = array.length - 1; i > 0; i--) {
21+
const j = Math.floor(Math.random() * (i + 1));
22+
[array[i], array[j]] = [array[j], array[i]];
23+
}
24+
return array;
25+
};
1726

1827

1928
interface Props {
@@ -22,14 +31,24 @@ interface Props {
2231
}
2332

2433
export const ExampleList = ({ onExampleClicked, useGPT4V }: Props) => {
25-
const { t } = useTranslation();
34+
const [currentExamples, setCurrentExamples] = useState<string[]>([]);
35+
36+
useEffect(() => {
37+
const loadExamples = () => {
38+
const examples = useGPT4V ? GPT4V_EXAMPLES : DEFAULT_EXAMPLES;
39+
setCurrentExamples(shuffleArray(examples).slice(0, 3));
40+
};
41+
42+
loadExamples();
43+
const intervalId = setInterval(loadExamples, 7000); // Replaced workerSetInterval
44+
45+
return () => clearInterval(intervalId); // Replaced workerClearInterval
46+
}, [useGPT4V]);
2647

27-
const DEFAULT_EXAMPLES: string[] = [t("defaultExamples.1"), t("defaultExamples.2"), t("defaultExamples.3")];
28-
const GPT4V_EXAMPLES: string[] = [t("gpt4vExamples.1"), t("gpt4vExamples.2"), t("gpt4vExamples.3")];
2948

3049
return (
3150
<ul className={styles.examplesNavList}>
32-
{(useGPT4V ? GPT4V_EXAMPLES : DEFAULT_EXAMPLES).map((question, i) => (
51+
{currentExamples.map((question, i) => (
3352
<li key={i}>
3453
<Example text={question} value={question} onClick={onExampleClicked} />
3554
</li>

app/frontend/src/i18n/examples.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
export const DEFAULT_EXAMPLES = [
2+
"What is Sanlam's IT Strategy?",
3+
"How was Retail Affluent's performance in 2023?",
4+
"What savings products does Sanlam sell?",
5+
"What risk products does Sanlam sell?",
6+
"What was the VNB for 2023?",
7+
"How was Retail Affluent's performance in 2022?",
8+
"Did Sanlam meet its 2023 targets?",
9+
"What is Wealth Bonus",
10+
"Which products include Wealth Bonus?",
11+
"How do I maximize my Wealth Bonus?",
12+
"What is an endowment?",
13+
"What is a retirement annuity?",
14+
"What is a pension fund?",
15+
"What is a unit trust?",
16+
"What is a tax free savings account?",
17+
"What is a living annuity?",
18+
"What is a preservation fund?",
19+
"What is a guaranteed annuity?",
20+
"How do I connect to Hive?",
21+
"What is the Two Pot system?",
22+
"Summarise the Two Pot system",
23+
"Why should I get a Will?",
24+
"Why would a client choose Sanlam for Insurance?",
25+
"What is disability cover?",
26+
"What is severe illness?",
27+
"What is income protection?",
28+
"What is funeral cover?",
29+
"What is life cover?",
30+
"What is credit life cover?",
31+
"How does credit life cover work?",
32+
"What is short term insurance?",
33+
"What is the difference between medical aid and medical insurance?",
34+
"What is SanlamAllianz?",
35+
"What is the difference between SanlamAllianz and Sanlam?",
36+
"What are the business clusters of Sanlam?",
37+
"What is Sanlam Emerging Markets?",
38+
"What is Sanlam Corporate?",
39+
"What is Sanlam Investments?",
40+
"What is Sanlam Life and Savings?",
41+
"What is Sanlam FinTech?",
42+
"How many days leave does each job grade get?",
43+
"Create a python function to connect to Hive"
44+
];
45+
46+
export const GPT4V_EXAMPLES = [
47+
"Compare the impact of interest rates and GDP in financial markets.",
48+
"What is the expected trend for the S&P 500 index over the next five years? Compare it to the past S&P 500 performance",
49+
"Can you identify any correlation between oil prices and stock market trends?"
50+
];
1.29 MB
Binary file not shown.
562 KB
Binary file not shown.

data/general/Two Pot System.pdf

448 KB
Binary file not shown.
4.79 MB
Binary file not shown.
252 KB
Binary file not shown.
404 KB
Binary file not shown.

data/hr_policies/Leave Policy.pdf

416 KB
Binary file not shown.
389 KB
Binary file not shown.

0 commit comments

Comments
 (0)