refactor: Integrate Posthog into Feature Flags & Telemetry & Error Services (#5275)
* refactor: posthog services: feature flags + error + telemtry - Convert PostHogClientProvider to singleton with lifecycle management - Update ErrorServices to use PostHogClientProvider - Update Telementry Service - Update and enable Feature Flags service * replace logger * fix imports - part 1 * update distinct ID * update * update * clean up * revert autoformat * fix merge conflicts * clean up autoformat * revert autoformatter * clean up logs
This commit is contained in:
23 files changed
+374
-362
No files matched your search
@@ -8,6 +8,7 @@ import path from "path"
|
||||
import fs from "fs/promises"
|
||||
import { fileExistsAtPath } from "@utils/fs"
|
||||
import { GlobalFileNames } from "@core/storage/disk"
|
||||
import { telemetryService } from "@/services/posthog/PostHogClientProvider"
|
||||
|
||||
/**
|
||||
* Refreshes the Groq models and returns the updated model list
|
||||
@@ -111,7 +112,12 @@ export async function refreshGroqModels(controller: Controller, request: EmptyRe
|
||||
errorMessage = error.message
|
||||
}
|
||||
|
||||
console.error("Groq API Error:", errorMessage)
|
||||
telemetryService.captureProviderApiError({
|
||||
taskId: controller.task?.taskId || "",
|
||||
errorMessage,
|
||||
errorStatus: error.status,
|
||||
model: "groq",
|
||||
})
|
||||
|
||||
// If we failed to fetch models, try to read cached models first
|
||||
const cachedModels = await readGroqModels(controller)
|
||||
@@ -181,7 +187,7 @@ async function readGroqModels(controller: Controller): Promise<Record<string, Pa
|
||||
*/
|
||||
function isValidChatModel(rawModel: any): boolean {
|
||||
// Check if model is active (if the property exists)
|
||||
if (rawModel.hasOwnProperty("active") && !rawModel.active) {
|
||||
if (Object.hasOwn(rawModel, "active") && !rawModel.active) {
|
||||
return false
|
||||
}
|
||||
// Filter out non-chat models (whisper, TTS, guard models, etc.)
|
||||
|
||||
Reference in new issue
Block a user