release: opensource snapshot 2026-02-27 19:25:00

This commit is contained in:
saturn
2026-02-27 19:25:00 +08:00
commit 5de9622c8b
1055 changed files with 164772 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
type CompletionResult = {
text: string
reasoning?: string
}
const state: { nextText: string; nextReasoning: string } = {
nextText: '{"ok":true}',
nextReasoning: '',
}
export function configureFakeLLM(result: CompletionResult) {
state.nextText = result.text
state.nextReasoning = result.reasoning || ''
}
export function resetFakeLLM() {
state.nextText = '{"ok":true}'
state.nextReasoning = ''
}
export async function fakeChatCompletion() {
return {
output_text: state.nextText,
reasoning: state.nextReasoning,
}
}

View File

@@ -0,0 +1,37 @@
const state: {
nextImageUrl: string
nextVideoUrl: string
nextAudioUrl: string
} = {
nextImageUrl: 'images/fake-image.jpg',
nextVideoUrl: 'video/fake-video.mp4',
nextAudioUrl: 'voice/fake-audio.mp3',
}
export function configureFakeMedia(params: {
imageUrl?: string
videoUrl?: string
audioUrl?: string
}) {
if (params.imageUrl) state.nextImageUrl = params.imageUrl
if (params.videoUrl) state.nextVideoUrl = params.videoUrl
if (params.audioUrl) state.nextAudioUrl = params.audioUrl
}
export function resetFakeMedia() {
state.nextImageUrl = 'images/fake-image.jpg'
state.nextVideoUrl = 'video/fake-video.mp4'
state.nextAudioUrl = 'voice/fake-audio.mp3'
}
export async function fakeGenerateImage() {
return { success: true, imageUrl: state.nextImageUrl }
}
export async function fakeGenerateVideo() {
return { success: true, videoUrl: state.nextVideoUrl }
}
export async function fakeGenerateAudio() {
return { success: true, audioUrl: state.nextAudioUrl }
}

View File

@@ -0,0 +1,35 @@
const providerState: {
falApiKey: string
googleApiKey: string
openrouterApiKey: string
} = {
falApiKey: 'fake-fal-key',
googleApiKey: 'fake-google-key',
openrouterApiKey: 'fake-openrouter-key',
}
export function configureFakeProviders(params: {
falApiKey?: string
googleApiKey?: string
openrouterApiKey?: string
}) {
if (params.falApiKey) providerState.falApiKey = params.falApiKey
if (params.googleApiKey) providerState.googleApiKey = params.googleApiKey
if (params.openrouterApiKey) providerState.openrouterApiKey = params.openrouterApiKey
}
export function resetFakeProviders() {
providerState.falApiKey = 'fake-fal-key'
providerState.googleApiKey = 'fake-google-key'
providerState.openrouterApiKey = 'fake-openrouter-key'
}
export function getFakeProviderConfig(provider: 'fal' | 'google' | 'openrouter') {
if (provider === 'fal') {
return { apiKey: providerState.falApiKey }
}
if (provider === 'google') {
return { apiKey: providerState.googleApiKey }
}
return { apiKey: providerState.openrouterApiKey }
}