-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from meta-d/develop
Develop v2.5.2
- Loading branch information
Showing
196 changed files
with
3,197 additions
and
1,048 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,8 @@ | ||
import { API_PREFIX } from '@metad/cloud/state' | ||
export const API_VISITS = API_PREFIX + '/visits' | ||
export const API_FEEDS = API_PREFIX + '/feeds' | ||
export const API_COPILOT_EXAMPLE = API_PREFIX + '/copilot-example' | ||
export const API_COPILOT_ROLE = API_PREFIX + '/copilot-role' | ||
export const API_COPILOT_KNOWLEDGE = API_PREFIX + '/copilot-knowledge' | ||
export const API_COPILOT_ROLE = API_PREFIX + '/copilot-role' | ||
export const API_COPILOT_USER = API_PREFIX + '/copilot-user' | ||
export const API_COPILOT_ORGANIZATION = API_PREFIX + '/copilot-organization' | ||
export const API_COPILOT_CHECKPOINT = API_PREFIX + '/copilot-checkpoint' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
apps/cloud/src/app/@core/services/copilot-usage.service.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { HttpClient } from '@angular/common/http' | ||
import { inject, Injectable } from '@angular/core' | ||
import { ICopilotOrganization, ICopilotUser } from '@metad/contracts' | ||
import { NGXLogger } from 'ngx-logger' | ||
import { map } from 'rxjs' | ||
import { API_COPILOT_ORGANIZATION, API_COPILOT_USER } from '../constants/app.constants' | ||
|
||
@Injectable({ providedIn: 'root' }) | ||
export class CopilotUsageService { | ||
readonly #logger = inject(NGXLogger) | ||
readonly httpClient = inject(HttpClient) | ||
|
||
getOrgUsages() { | ||
return this.httpClient | ||
.get<{ items: ICopilotOrganization[] }>(API_COPILOT_ORGANIZATION, { | ||
params: { | ||
$relations: JSON.stringify(['org']) | ||
} | ||
}) | ||
.pipe(map(({ items }) => items)) | ||
} | ||
|
||
getUserUsages() { | ||
return this.httpClient | ||
.get<{ items: ICopilotUser[] }>(API_COPILOT_USER, { | ||
params: { | ||
$relations: JSON.stringify(['user', 'org']) | ||
} | ||
}) | ||
.pipe(map(({ items }) => items)) | ||
} | ||
|
||
renewOrgLimit(id: string, tokenLimit: number) { | ||
return this.httpClient.post<ICopilotOrganization>(API_COPILOT_ORGANIZATION + `/${id}/renew`, { tokenLimit }) | ||
} | ||
|
||
renewUserLimit(id: string, tokenLimit: number) { | ||
return this.httpClient.post<ICopilotUser>(API_COPILOT_USER + `/${id}/renew`, { tokenLimit }) | ||
} | ||
} |
Oops, something went wrong.