mirror of
https://github.com/cline/cline.git
synced 2026-09-19 02:05:44 +08:00
* Working organization and personal inference, account switching, and usage/credit reporting. * Organization dropdown tweaks (#4710) * organization dropdown tweaks * reverted AuthService * Update Firebase Provider and Auth Service to support re-hydration of the user credentials * Add Github Auth Flow * Fix merge conflicts * Fix some dumb typing * recreate dropdown value when initialized (#4716) * added changeset * Update urls to production and handle some PR concerns * Get user credits when signing in (#4736) * get user balance when signing in instead of when there is no active org * swapped order of getUserCredits, made calls async * async changes continued, moved setIsLoading to finally --------- Co-authored-by: canvrno <46584286+canvrno@users.noreply.github.com> Co-authored-by: pashpashpash <nik@cline.bot>
25 lines
770 B
TypeScript
25 lines
770 B
TypeScript
import type { Controller } from "../index"
|
|
import { Empty } from "@shared/proto/common"
|
|
import { UserOrganizationUpdateRequest } from "@shared/proto/account"
|
|
|
|
/**
|
|
* Handles setting the user's active organization
|
|
* @param controller The controller instance
|
|
* @param request UserOrganization to set as active
|
|
* @returns Empty response
|
|
*/
|
|
export async function setUserOrganization(controller: Controller, request: UserOrganizationUpdateRequest): Promise<Empty> {
|
|
try {
|
|
if (!controller.accountService) {
|
|
throw new Error("Account service not available")
|
|
}
|
|
|
|
// Switch to the specified organization using the account service
|
|
await controller.accountService.switchAccount(request.organizationId)
|
|
|
|
return Empty.create({})
|
|
} catch (error) {
|
|
throw error
|
|
}
|
|
}
|