Skip to content

Commit

Permalink
Cleanup more leftover code from raycast-gemini
Browse files Browse the repository at this point in the history
  • Loading branch information
XInTheDark committed May 3, 2024
1 parent 5413531 commit 273fe8d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 17 deletions.
16 changes: 4 additions & 12 deletions src/api/gpt.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export default (props, { context = undefined, allowPaste = false, useSelected =
const [lastQuery, setLastQuery] = useState("");
const [lastResponse, setLastResponse] = useState("");

const getResponse = async (query, data) => {
const getResponse = async (query) => {
setLastQuery(query);
setPage(Pages.Detail);

Expand All @@ -82,7 +82,7 @@ export default (props, { context = undefined, allowPaste = false, useSelected =
const start = Date.now();

try {
console.log(query, data ?? buffer);
console.log(query);
const messages = [{ role: "user", content: query }];
// load provider and model from preferences
const preferences = getPreferenceValues();
Expand Down Expand Up @@ -197,25 +197,17 @@ export default (props, { context = undefined, allowPaste = false, useSelected =
onSubmit={(values) => {
setMarkdown("");

let files = undefined;
if (values.files) {
files = values.files
.filter((file) => fs.existsSync(file) && fs.lstatSync(file).isFile())
.map((file) => fs.readFileSync(file));
}

if (useSelected) {
getResponse(`${values.query}\n${selectedState}`, files);
getResponse(`${values.query}\n${selectedState}`);

Check notice on line 201 in src/api/gpt.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Result of method call returning a promise is ignored

Promise returned from getResponse is ignored
return;
}
getResponse(`${context ? `${context}\n\n` : ""}${values.query}`, files);
getResponse(`${context ? `${context}\n\n` : ""}${values.query}`);

Check notice on line 204 in src/api/gpt.jsx

View workflow job for this annotation

GitHub Actions / Qodana for JS

Result of method call returning a promise is ignored

Promise returned from getResponse is ignored
}}
/>
</ActionPanel>
}
>
<Form.TextArea title="Prompt" id="query" />
{!buffer.length}
</Form>
);
};
Expand Down
6 changes: 1 addition & 5 deletions src/askAI.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
import useGPT from "./api/gpt";

export default function AskAI(props) {
if (props?.launchContext?.buffer) {
return useGPT({ ...props, arguments: props?.launchContext?.args }, { buffer: props?.launchContext?.buffer });
} else {
return useGPT(props, {});
}
return useGPT(props, {});
}

0 comments on commit 273fe8d

Please sign in to comment.