Skip to content

Commit 9a5bfa9

Browse files
committed
Show status in AI query component
It no longer handles final rendering, just loading state
1 parent 6ee8d6a commit 9a5bfa9

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

src/AiQuery.tsx

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,7 @@ import {
44
OpenAiApi,
55
CallOpenAi,
66
} from './OpenAI';
7-
import {
8-
AiSection,
9-
AiImageResponse,
10-
AiTextResponse,
11-
} from './AiResponse';
7+
import { AiSection } from './AiResponse';
128
import {
139
ChatSource,
1410
ChatContent,
@@ -157,20 +153,16 @@ Respond with the image prompt string in the required format. Do not respond conv
157153
return (
158154
<AiSection isLoading={isLoading}>
159155
{
160-
// TODO: All of this can go away now, once images are working in new model
161-
(isLoading || error) ?
162-
<Text style={{color: 'crimson'}}>{error}</Text>
163-
: isRequestForImage ?
164-
<AiImageResponse
165-
imageUrl={queryResult}
166-
prompt={imagePrompt}
167-
rejectImage={() => {
168-
setIsRequestForImage(false);
169-
setQueryResult(undefined);
170-
}}/>
171-
: // Not an error, not an image
172-
<AiTextResponse
173-
text={queryResult}/>
156+
(isLoading ?
157+
isRequestForImage === undefined ?
158+
<Text>Identifying intent...</Text> :
159+
isRequestForImage === true ?
160+
imagePrompt === undefined ?
161+
<Text>Generating keywords for an image...</Text> :
162+
<Text>Generating image...</Text> :
163+
<Text>Generating text...</Text>
164+
:
165+
<Text>Done loading</Text>)
174166
}
175167
</AiSection>
176168
)

0 commit comments

Comments
 (0)