Skip to content

Commit

Permalink
fix: build
Browse files Browse the repository at this point in the history
  • Loading branch information
seawatts committed Jan 30, 2025
1 parent 3d3b454 commit 210977c
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 486 deletions.
94 changes: 0 additions & 94 deletions integ-tests/react/src/app/example.tsx

This file was deleted.

61 changes: 25 additions & 36 deletions integ-tests/react/src/app/test-client.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
'use client'

import * as React from 'react'
import { useTestAws} from '../../baml_client/react/client'
import { useTestAws } from '../../baml_client/react/client'
// import { useLLM, useTestAws, useTestUniverseQuestion} from '../../baml_client/react/client'
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { Button } from "@/components/ui/button"
import { Input } from "@/components/ui/input"
import { Label } from "@/components/ui/label"
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'
import { Button } from '@/components/ui/button'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
// import { TestAwsAction} from '../../baml_client/react/server'
import type { StreamingHookResult, NonStreamingHookResult } from '../../baml_client/react/types'
import type { StreamingHookResult } from '../../baml_client/react/types'
import type { TestAwsAction } from '../../baml_client/react/server'
import { Loader2 } from 'lucide-react'
import { Alert, AlertDescription } from '@/components/ui/alert'

type ResponseCardProps = {
// hookResult: StreamingHookResult<typeof ServerActions.TestAwsAction> | NonStreamingHookResult<typeof ServerActions.TestAwsAction>
hookResult: StreamingHookResult<typeof TestAwsAction>
hookResult: StreamingHookResult<typeof TestAwsAction>
// hookResult: NonStreamingHookResult<typeof ServerActions.TestAwsAction>
status: StreamingHookResult['status']
}
Expand All @@ -27,27 +27,23 @@ function ResponseCard({ hookResult }: ResponseCardProps) {
return (
<>
{isError && (
<Alert variant="destructive" className="mt-4">
<AlertDescription>
Error: {error?.message}
</AlertDescription>
<Alert variant='destructive' className='mt-4'>
<AlertDescription>Error: {error?.message}</AlertDescription>
</Alert>
)}

{response && (
<div className="mt-6 space-y-2">
<div className='mt-6 space-y-2'>
<Card>
<CardContent className="pt-6">
<pre className="whitespace-pre-wrap font-mono text-sm bg-muted p-4 rounded-lg">
<CardContent className='pt-6'>
<pre className='whitespace-pre-wrap font-mono text-sm bg-muted p-4 rounded-lg'>
{typeof response === 'string' ? response : JSON.stringify(response, null, 2)}
</pre>
</CardContent>
</Card>
</div>
)}
<CardFooter className="text-sm text-muted-foreground text-center">
{status}
</CardFooter>
<CardFooter className='text-sm text-muted-foreground text-center'>{status}</CardFooter>
</>
)
}
Expand Down Expand Up @@ -99,7 +95,6 @@ export default function TestClient() {
// nonStreamingDirectAction.partialData satisfies never | undefined;
// nonStreamingDirectAction.mutate satisfies (input: string) => Promise<string>;


// const streamingIndirectAction = useLLM(TestAwsAction, {
// stream: true,
// onPartial: (response) => {
Expand Down Expand Up @@ -159,9 +154,9 @@ export default function TestClient() {
// },
// })

const {isPending, error, isError, isSuccess, mutate, status, data, partialData} = streamingDirectAction;
const { isPending, error, isError, isSuccess, mutate, status, data, partialData } = streamingDirectAction

const response = isPending? partialData: data
const response = isPending ? partialData : data
const [prompt, setPrompt] = React.useState('')

const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
Expand All @@ -174,34 +169,28 @@ export default function TestClient() {
}

return (
<Card className="w-full">
<Card className='w-full'>
<CardHeader>
<CardTitle>BAML AWS Test</CardTitle>
<CardDescription>
Test the BAML AWS integration by entering some text below.
</CardDescription>
<CardDescription>Test the BAML AWS integration by entering some text below.</CardDescription>
</CardHeader>

<CardContent>
<form onSubmit={handleSubmit} className="space-y-4">
<div className="space-y-2">
<Label htmlFor="prompt">Test Input</Label>
<form onSubmit={handleSubmit} className='space-y-4'>
<div className='space-y-2'>
<Label htmlFor='prompt'>Test Input</Label>
<Input
id="prompt"
type="text"
id='prompt'
type='text'
value={prompt}
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setPrompt(e.target.value)}
placeholder="Type something..."
placeholder='Type something...'
disabled={isPending}
/>
</div>

<Button
type="submit"
className="w-full"
disabled={isPending || !prompt.trim()}
>
{isPending && <Loader2 className="mr-2 h-4 w-4 animate-spin" />}
<Button type='submit' className='w-full' disabled={isPending || !prompt.trim()}>
{isPending && <Loader2 className='mr-2 h-4 w-4 animate-spin' />}
{isPending ? 'Processing...' : 'Submit'}
</Button>
</form>
Expand Down
2 changes: 1 addition & 1 deletion integ-tests/react/src/components/theme-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import * as React from "react"
import { ThemeProvider as NextThemesProvider } from "next-themes"
import { type ThemeProviderProps } from "next-themes/dist/types"
import { type ThemeProviderProps } from "next-themes"

export function ThemeProvider({ children, ...props }: ThemeProviderProps) {
return <NextThemesProvider {...props}>{children}</NextThemesProvider>
Expand Down
Loading

0 comments on commit 210977c

Please sign in to comment.