fix: build TypeScript — moduleResolution Bundler + casts API — 117/117 tests
This commit is contained in:
parent
5b82c6bd46
commit
dd2dfaa662
5 changed files with 19 additions and 12 deletions
|
|
@ -87,7 +87,9 @@ export async function correctEE(contenu: string, tache: string): Promise<EERappo
|
|||
throw new Error(`DeepSeek API error: ${response.status} ${response.statusText}`)
|
||||
}
|
||||
|
||||
const data = await response.json()
|
||||
const data = (await response.json()) as {
|
||||
choices?: { message?: { content?: string } }[]
|
||||
}
|
||||
const content = data.choices?.[0]?.message?.content
|
||||
|
||||
if (!content) {
|
||||
|
|
@ -160,7 +162,9 @@ export async function correctEO(transcript: string, tache: string): Promise<EORa
|
|||
throw new Error(`DeepSeek API error: ${response.status} ${response.statusText}`)
|
||||
}
|
||||
|
||||
const data = await response.json()
|
||||
const data = (await response.json()) as {
|
||||
choices?: { message?: { content?: string } }[]
|
||||
}
|
||||
const content = data.choices?.[0]?.message?.content
|
||||
|
||||
if (!content) {
|
||||
|
|
|
|||
|
|
@ -27,7 +27,9 @@ export async function transcribeAudio(
|
|||
throw new Error(`Gemini API error: ${response.status} ${response.statusText}`)
|
||||
}
|
||||
|
||||
const data = await response.json()
|
||||
const data = (await response.json()) as {
|
||||
candidates?: { content?: { parts?: { text?: string }[] } }[]
|
||||
}
|
||||
const text = data.candidates?.[0]?.content?.parts?.[0]?.text
|
||||
|
||||
if (!text || typeof text !== 'string' || text.trim().length === 0) {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import type { Context, Next } from 'hono'
|
||||
import { getPlanPermissions } from '../lib/access'
|
||||
import type { Feature } from '../lib/access'
|
||||
import { checkFeatureAccess, getPlanPermissions } from '../lib/access'
|
||||
import type { Feature, Plan } from '../lib/access'
|
||||
import type { AppVariables } from './auth'
|
||||
|
||||
/**
|
||||
|
|
@ -12,9 +12,9 @@ export function planMiddleware(feature: Feature) {
|
|||
return async (c: Context<{ Variables: AppVariables }>, next: Next) => {
|
||||
const profile = c.get('profile')
|
||||
|
||||
let perms: ReturnType<typeof getPlanPermissions>
|
||||
const plan = profile.plan as Plan
|
||||
try {
|
||||
perms = getPlanPermissions(profile.plan as 'free' | 'standard' | 'premium')
|
||||
getPlanPermissions(plan)
|
||||
} catch {
|
||||
return c.json(
|
||||
{
|
||||
|
|
@ -26,7 +26,7 @@ export function planMiddleware(feature: Feature) {
|
|||
)
|
||||
}
|
||||
|
||||
if (!perms[feature]) {
|
||||
if (!checkFeatureAccess(plan, feature)) {
|
||||
return c.json(
|
||||
{
|
||||
error: true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue