feat: add NSFW script generation feature and Grok API configuration
This commit is contained in:
@@ -224,6 +224,11 @@ export const authApi = {
|
||||
return response.data
|
||||
},
|
||||
|
||||
getNsfwAccess: async (): Promise<{ has_access: boolean }> => {
|
||||
const response = await apiClient.get<{ has_access: boolean }>(API_ENDPOINTS.AUTH.NSFW_ACCESS)
|
||||
return response.data
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
export interface BackendStats {
|
||||
@@ -272,6 +277,21 @@ export const adminApi = {
|
||||
await apiClient.delete(API_ENDPOINTS.ADMIN.LLM_CONFIG)
|
||||
},
|
||||
|
||||
getGrokConfig: async (): Promise<{ base_url?: string; model?: string; has_key: boolean }> => {
|
||||
const response = await apiClient.get<{ base_url?: string; model?: string; has_key: boolean }>(
|
||||
API_ENDPOINTS.ADMIN.GROK_CONFIG
|
||||
)
|
||||
return response.data
|
||||
},
|
||||
|
||||
setGrokConfig: async (config: { base_url: string; api_key: string; model: string }): Promise<void> => {
|
||||
await apiClient.put(API_ENDPOINTS.ADMIN.GROK_CONFIG, config)
|
||||
},
|
||||
|
||||
deleteGrokConfig: async (): Promise<void> => {
|
||||
await apiClient.delete(API_ENDPOINTS.ADMIN.GROK_CONFIG)
|
||||
},
|
||||
|
||||
getUsage: async (dateFrom?: string, dateTo?: string): Promise<UserUsageStats[]> => {
|
||||
const params: Record<string, string> = {}
|
||||
if (dateFrom) params.date_from = dateFrom
|
||||
|
||||
@@ -78,6 +78,26 @@ export interface LLMConfig {
|
||||
has_key: boolean
|
||||
}
|
||||
|
||||
export interface NsfwSynopsisGenerationRequest {
|
||||
genre: string
|
||||
subgenre?: string
|
||||
protagonist_type?: string
|
||||
tone?: string
|
||||
conflict_scale?: string
|
||||
num_characters?: number
|
||||
num_chapters?: number
|
||||
}
|
||||
|
||||
export interface NsfwScriptGenerationRequest {
|
||||
title: string
|
||||
genre: string
|
||||
subgenre?: string
|
||||
premise: string
|
||||
style?: string
|
||||
num_characters?: number
|
||||
num_chapters?: number
|
||||
}
|
||||
|
||||
export const audiobookApi = {
|
||||
generateSynopsis: async (data: SynopsisGenerationRequest): Promise<string> => {
|
||||
const response = await apiClient.post<{ synopsis: string }>('/audiobook/projects/generate-synopsis', data)
|
||||
@@ -89,6 +109,16 @@ export const audiobookApi = {
|
||||
return response.data
|
||||
},
|
||||
|
||||
generateNsfwSynopsis: async (data: NsfwSynopsisGenerationRequest): Promise<string> => {
|
||||
const response = await apiClient.post<{ synopsis: string }>('/audiobook/projects/generate-synopsis-nsfw', data)
|
||||
return response.data.synopsis
|
||||
},
|
||||
|
||||
createNsfwScript: async (data: NsfwScriptGenerationRequest): Promise<AudiobookProject> => {
|
||||
const response = await apiClient.post<AudiobookProject>('/audiobook/projects/generate-script-nsfw', data)
|
||||
return response.data
|
||||
},
|
||||
|
||||
createProject: async (data: {
|
||||
title: string
|
||||
source_type: string
|
||||
|
||||
@@ -6,6 +6,7 @@ export const API_ENDPOINTS = {
|
||||
PREFERENCES: '/auth/preferences',
|
||||
SET_ALIYUN_KEY: '/auth/aliyun-key',
|
||||
VERIFY_ALIYUN_KEY: '/auth/aliyun-key/verify',
|
||||
NSFW_ACCESS: '/auth/nsfw-access',
|
||||
},
|
||||
TTS: {
|
||||
LANGUAGES: '/tts/languages',
|
||||
@@ -32,6 +33,7 @@ export const API_ENDPOINTS = {
|
||||
SET_ALIYUN_KEY: '/users/system/aliyun-key',
|
||||
VERIFY_ALIYUN_KEY: '/users/system/aliyun-key/verify',
|
||||
LLM_CONFIG: '/users/system/llm-config',
|
||||
GROK_CONFIG: '/users/system/grok-config',
|
||||
},
|
||||
VOICE_DESIGNS: {
|
||||
LIST: '/voice-designs',
|
||||
|
||||
Reference in New Issue
Block a user