Skip to content

Commit

Permalink
Fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyRonning committed Feb 10, 2025
1 parent 1a6a7bc commit fb320d0
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 143 deletions.
20 changes: 9 additions & 11 deletions src/AI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export function AI() {
setResponse("");

if (!os.auth.user) {
alert("Please log in to use the AI chat.");
return;
alert("Please log in to use the AI chat.");
return;
}

const customFetch = os.aiCustomFetch;
Expand All @@ -30,16 +30,16 @@ export function AI() {

try {
console.log("Starting chat request to URL:", `${os.apiUrl}/v1/`);

const openai = new OpenAI({
baseURL: `${os.apiUrl}/v1/`,
dangerouslyAllowBrowser: true,
apiKey: "api-key-doesnt-matter",
defaultHeaders: {
"Accept-Encoding": "identity",
"Content-Type": "application/json",
"Content-Type": "application/json"
},
fetch: customFetch,
fetch: customFetch
});

console.log("Created OpenAI client");
Expand All @@ -51,7 +51,7 @@ export function AI() {
const stream = await openai.beta.chat.completions.stream({
model,
messages,
stream: true,
stream: true
});

console.log("Stream created successfully");
Expand Down Expand Up @@ -95,8 +95,8 @@ export function AI() {
className="w-full p-2 border rounded"
disabled={loading}
/>
<button
type="submit"
<button
type="submit"
disabled={loading}
className="mt-2 px-4 py-2 bg-blue-500 text-white rounded disabled:bg-gray-400"
>
Expand All @@ -105,9 +105,7 @@ export function AI() {
</form>

{response && (
<div className="mt-4 p-4 border rounded bg-gray-50 whitespace-pre-wrap">
{response}
</div>
<div className="mt-4 p-4 border rounded bg-gray-50 whitespace-pre-wrap">{response}</div>
)}
</div>
);
Expand Down
5 changes: 4 additions & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@ button {

.grid-container {
display: grid;
grid-template-columns: minmax(min-content, 150px) 1fr minmax(min-content, 120px) minmax(min-content, 120px);
grid-template-columns: minmax(min-content, 150px) 1fr minmax(min-content, 120px) minmax(
min-content,
120px
);
gap: 1rem;
}

Expand Down
Loading

0 comments on commit fb320d0

Please sign in to comment.