@follow-app/client-sdk
Version:
TypeScript client SDK for Follow RSS Server API
108 lines (86 loc) • 2.19 kB
text/typescript
// Auto-generated types for ai module
import type { languageSchema } from "@folo-services/drizzle"
import type { z } from "zod"
import type { SuccessResponse } from "../../types"
type LanguageSchema = z.infer<typeof languageSchema>
// Chat module types
export interface ChatMessage {
role: string
content: string
}
export interface ChatContext {
mainEntryId?: string
referEntryIds?: string[]
referFeedIds?: string[]
selectedText?: string
}
export interface ChatRequest {
messages: ChatMessage[]
context?: ChatContext
}
// Chat response is a streaming Response object for text/event-stream
export type ChatResponse = Response
// Summary module types
export interface SummaryRequest {
id: string
language?: LanguageSchema
target?: "content" | "readabilityContent"
}
export type SummaryResponse = SuccessResponse<string | null>
// Translation module types
export type EntryStringKey =
| "title" |
"description" |
"content" |
"readabilityContent"
export interface TranslationRequest {
id: string
language: LanguageSchema
fields: string
part?: string
}
export interface TranslationData {
title?: string
description?: string
content?: string
readabilityContent?: string
}
export type TranslationResponse = SuccessResponse<TranslationData | null>
// Title generation module types
export interface TitleRequest {
messages: ChatMessage[]
}
export interface TitleResponse {
title: string
remainingTokens?: number
}
export interface TitleErrorResponse {
error: string
}
// Daily summary module types
export interface DailyRequest {
startDate: string
view: "0" | "1"
}
export type DailyResponse = SuccessResponse<string>
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface UsageRequest {}
export type UsageResponse = SuccessResponse<{
total: number
used: number
remaining: number
resetAt: Date
}>
// Config module types
export interface RateLimit {
maxTokens: number
currentTokens: number
remainingTokens: number
windowDuration: number
windowResetTime: number
}
export interface ConfigResponse {
currentModel: string
availableModels: string[]
rateLimit: RateLimit
}