Buckets:
GHHG10/CodeServer / opencode /packages /console /app /src /routes /zen /util /stickyProviderTracker.ts
| import { Database, eq } from "@opencode-ai/console-core/drizzle/index.js" | |
| import { ModelStickyProviderTable } from "@opencode-ai/console-core/schema/ip.sql.js" | |
| export function createStickyTracker( | |
| modelId: string, | |
| stickyProvider: "strict" | "prefer" | undefined, | |
| stickyId: string, | |
| ) { | |
| if (!stickyProvider) return | |
| if (!stickyId) return | |
| const id = `${modelId}/${stickyId}` | |
| let _providerId: string | undefined | |
| return { | |
| get: async () => { | |
| const data = await Database.use((tx) => | |
| tx | |
| .select({ | |
| providerId: ModelStickyProviderTable.providerId, | |
| }) | |
| .from(ModelStickyProviderTable) | |
| .where(eq(ModelStickyProviderTable.id, id)) | |
| .limit(1), | |
| ) | |
| _providerId = data[0]?.providerId | |
| return _providerId | |
| }, | |
| set: async (providerId: string) => { | |
| if (_providerId === providerId) return | |
| await Database.use((tx) => | |
| tx | |
| .insert(ModelStickyProviderTable) | |
| .values({ | |
| id, | |
| providerId, | |
| }) | |
| .onDuplicateKeyUpdate({ | |
| set: { | |
| providerId, | |
| }, | |
| }), | |
| ) | |
| }, | |
| } | |
| } | |
Xet Storage Details
- Size:
- 1.18 kB
- Xet hash:
- faf4c5a483f548357135539873e59dbf5484e6b3b1220d0101a8d7e8316116a9
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.