ciyidogan commited on
Commit
b83b49a
·
verified ·
1 Parent(s): 7fb37b4

Update flare-ui/src/app/services/api.service.ts

Browse files
flare-ui/src/app/services/api.service.ts CHANGED
@@ -299,22 +299,29 @@ export class ApiService {
299
  }
300
 
301
  // ===================== Chat =====================
302
- startChat() {
303
- return this.http.post(`${this.apiUrl}/start_chat`, {}, {
304
- headers: this.getAuthHeaders()
305
- }).pipe(
306
- catchError(this.handleError)
307
- );
308
  }
309
-
 
 
 
 
 
 
 
 
 
310
  chat(sessionId: string, text: string) {
311
- return this.http.post(`${this.apiUrl}/chat`, {
312
- session_id: sessionId,
313
- text
314
- }, {
315
- headers: this.getAuthHeaders()
316
- }).pipe(
317
- catchError(this.handleError)
 
318
  );
319
  }
320
 
 
299
  }
300
 
301
  // ===================== Chat =====================
302
+ /* 1️⃣ Proje isimleri (combo’yu doldurmak için) */
303
+ getChatProjects() {
304
+ return this.http.get<string[]>(`${this.baseUrl}/projects/names`);
 
 
 
305
  }
306
+
307
+ /* 2️⃣ Oturum başlat */
308
+ startChat(projectName: string) {
309
+ return this.http.post<{
310
+ session_id: string;
311
+ answer: string;
312
+ }>(`${this.baseUrl}/start_session`, { project_name: projectName });
313
+ }
314
+
315
+ /* 3️⃣ Mesaj gönder/al */
316
  chat(sessionId: string, text: string) {
317
+ const headers = new HttpHeaders().set('X-Session-ID', sessionId);
318
+ return this.http.post<{
319
+ session_id: string;
320
+ answer: string;
321
+ }>(
322
+ `${this.baseUrl}/chat`,
323
+ { user_input: text },
324
+ { headers }
325
  );
326
  }
327