Oviya commited on
Commit
0354b8e
·
1 Parent(s): 4fd4bb8

add local/hg links

Browse files
src/app/chatbot/chatbot.ts CHANGED
@@ -17,6 +17,11 @@ export class Chatbot {
17
  // Define messages array to store conversation
18
  messages: { user: string, bot: string }[] = []; // This is the missing property
19
 
 
 
 
 
 
20
  // Handle user input and make API call to backend
21
  async getChatbotResponse() {
22
  if (this.userQuestion.trim()) {
@@ -25,7 +30,8 @@ export class Chatbot {
25
 
26
  try {
27
  // Make API call to backend for the answer
28
- const response = await axios.post('http://127.0.0.1:5000/ask', {
 
29
  question: this.userQuestion
30
  });
31
 
 
17
  // Define messages array to store conversation
18
  messages: { user: string, bot: string }[] = []; // This is the missing property
19
 
20
+ private readonly baseUrl =
21
+ location.hostname.endsWith('hf.space')
22
+ ? 'https://pykara-pytrade-backend.hf.space'
23
+ : 'http://127.0.0.1:5000'; // change to 5400 if your local backend uses that port
24
+
25
  // Handle user input and make API call to backend
26
  async getChatbotResponse() {
27
  if (this.userQuestion.trim()) {
 
30
 
31
  try {
32
  // Make API call to backend for the answer
33
+ const response = await axios.post(`${this.baseUrl}/ask`, {
34
+ //const response = await axios.post('https://pykara-pytrade-backend.hf.space/ask', {
35
  question: this.userQuestion
36
  });
37
 
src/app/marketselect/market.service.ts CHANGED
@@ -7,8 +7,15 @@ import { of } from 'rxjs';
7
  })
8
  export class MarketService {
9
 
10
- private pyCompaniesApiUrl = 'http://127.0.0.1:5000/getcompanies';
11
- private pyAnalyseApiUrl = 'http://127.0.0.1:5000/analysestock';
 
 
 
 
 
 
 
12
  constructor(private http: HttpClient) { }
13
 
14
  getCompanies(): Observable<any> {
 
7
  })
8
  export class MarketService {
9
 
10
+ private readonly baseUrl =
11
+ location.hostname.endsWith('hf.space')
12
+ ? 'https://pykara-pytrade-backend.hf.space'
13
+ : 'http://127.0.0.1:5000'; // change to 5400 if your local backend uses that port
14
+
15
+ private pyCompaniesApiUrl = `${this.baseUrl}/getcompanies`;
16
+ private pyAnalyseApiUrl = `${this.baseUrl}/analysestock`;
17
+ //private pyCompaniesApiUrl = 'https://pykara-pytrade-backend.hf.space/getcompanies';
18
+ //private pyAnalyseApiUrl = 'https://pykara-pytrade-backend.hf.space/analysestock';
19
  constructor(private http: HttpClient) { }
20
 
21
  getCompanies(): Observable<any> {
src/app/toolspage/toolspage.component.ts CHANGED
@@ -24,8 +24,13 @@ type MarketMap = Record<string, Record<string, IndexRef[]>>;
24
  styleUrls: ['./toolspage.component.css']
25
  })
26
  export class ToolspageComponent {
 
 
 
 
 
27
  /** Flask base URL */
28
- private readonly API = 'http://127.0.0.1:5000';
29
  loading = false;
30
  /** error message surface used by template: <div *ngIf="error">{{error}}</div> */
31
  public error: string | null = null;
 
24
  styleUrls: ['./toolspage.component.css']
25
  })
26
  export class ToolspageComponent {
27
+
28
+ private readonly API =
29
+ location.hostname.endsWith('hf.space')
30
+ ? 'https://pykara-pytrade-backend.hf.space'
31
+ : 'http://127.0.0.1:5000'; // change to 5400 if your local backend uses that port
32
  /** Flask base URL */
33
+ //private readonly API = 'https://pykara-pytrade-backend.hf.space';
34
  loading = false;
35
  /** error message surface used by template: <div *ngIf="error">{{error}}</div> */
36
  public error: string | null = null;