mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-04-30 04:30:48 +00:00
Simplify streaming code for code assist server (#4619)
This commit is contained in:
parent
f95674e646
commit
d7a57d85a3
10 changed files with 36 additions and 133 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue