Add image generation feature with new component and service integration

This commit is contained in:
liosha84
2025-07-03 20:23:21 +03:00
parent afb12a131e
commit f211a0d146
29 changed files with 6038 additions and 259 deletions
@@ -21,6 +21,10 @@ export class SystemService {
return this.http.get<Bean[]>(this.baseUrl+"/beans");
}
getImage(): Observable<Blob> {
return this.http.get(this.baseUrl+"/image", {responseType: 'blob'});
}
getCustomBeans(): Observable<Bean[]> {
return this.http.get<Bean[]>(this.baseUrl+"/beans/custom");
}
@@ -0,0 +1,16 @@
import { TestBed } from '@angular/core/testing';
import { ZhipuaiImageService } from './zhipuai-image.service';
describe('ZhipuaiImageService', () => {
let service: ZhipuaiImageService;
beforeEach(() => {
TestBed.configureTestingModule({});
service = TestBed.inject(ZhipuaiImageService);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
});
@@ -0,0 +1,25 @@
import { Injectable } from '@angular/core';
import {Observable} from 'rxjs';
import {Tutorial} from '../models/tutorial.model';
import {HttpClient} from '@angular/common/http';
import {Image} from '../models/image';
import {SpinnerService} from './spinner.service';
@Injectable({
providedIn: 'root'
})
export class ZhipuaiImageService {
baseUrl : string = 'http://localhost:8080/api/zhipuai';
constructor(private http: HttpClient,public spinnerService: SpinnerService) {
}
generate(query: String): Observable<Image> {
return this.http.get(`${(this.baseUrl)}/image/${query}`);
}
}