mirror of
https://github.com/QwenLM/qwen-code.git
synced 2025-12-19 09:33:53 +00:00
Simplify streaming code for code assist server (#4619)
This commit is contained in:
committed by
GitHub
parent
f95674e646
commit
d7a57d85a3
@@ -22,12 +22,17 @@ export class ProjectIdRequiredError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
export interface UserData {
|
||||
projectId: string;
|
||||
userTier: UserTierId;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param projectId the user's project id, if any
|
||||
* @returns the user's actual project id
|
||||
*/
|
||||
export async function setupUser(client: OAuth2Client): Promise<string> {
|
||||
export async function setupUser(client: OAuth2Client): Promise<UserData> {
|
||||
let projectId = process.env.GOOGLE_CLOUD_PROJECT || undefined;
|
||||
const caServer = new CodeAssistServer(client, projectId);
|
||||
|
||||
@@ -64,7 +69,10 @@ export async function setupUser(client: OAuth2Client): Promise<string> {
|
||||
await new Promise((f) => setTimeout(f, 5000));
|
||||
lroRes = await caServer.onboardUser(onboardReq);
|
||||
}
|
||||
return lroRes.response?.cloudaicompanionProject?.id || '';
|
||||
return {
|
||||
projectId: lroRes.response?.cloudaicompanionProject?.id || '',
|
||||
userTier: tier.id,
|
||||
};
|
||||
}
|
||||
|
||||
function getOnboardTier(res: LoadCodeAssistResponse): GeminiUserTier {
|
||||
|
||||
Reference in New Issue
Block a user