Skip to content

Commit

Permalink
fix lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
AmruthPillai committed Jan 11, 2025
1 parent 8a401de commit 02ce1ad
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 19 deletions.
7 changes: 1 addition & 6 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
{
"recommendations": [
"nrwl.angular-console",
"esbenp.prettier-vscode",
"dbaeumer.vscode-eslint",
"firsttris.vscode-jest-runner"
]
"recommendations": ["nrwl.angular-console", "esbenp.prettier-vscode", "dbaeumer.vscode-eslint"]
}
2 changes: 1 addition & 1 deletion apps/client/src/constants/llm.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export const DEFAULT_MODEL = "gpt-3.5-turbo";
export const DEFAULT_MAX_TOKENS = 1024
export const DEFAULT_MAX_TOKENS = 1024;
13 changes: 8 additions & 5 deletions apps/client/src/pages/dashboard/settings/_sections/openai.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,19 @@ import { cn } from "@reactive-resume/utils";
import { useForm } from "react-hook-form";
import { z } from "zod";

import { useOpenAiStore } from "@/client/stores/openai";
import { DEFAULT_MAX_TOKENS, DEFAULT_MODEL } from "@/client/constants/llm";
import { useOpenAiStore } from "@/client/stores/openai";

const formSchema = z.object({
apiKey: z
.string()
// eslint-disable-next-line lingui/t-call-in-function
.regex(/^sk-.+$/, t`That doesn't look like a valid OpenAI API key.`)
// eslint-disable-next-line lingui/no-unlocalized-strings
.regex(/^sk-.+$/, "That doesn't look like a valid OpenAI API key.")
.default(""),
baseURL: z
.string()
.regex(/https?:\/\/[^\/]+\/?v1$/, t`That doesn't look like a valid URL`)
// eslint-disable-next-line lingui/no-unlocalized-strings
.regex(/https?:\/\/[^/]+\/?v1$/, "That doesn't look like a valid URL")
.default(""),
model: z.string().default(DEFAULT_MODEL),
maxTokens: z.number().default(DEFAULT_MAX_TOKENS),
Expand Down Expand Up @@ -162,7 +163,9 @@ export const OpenAISettings = () => {
type="number"
placeholder={`${DEFAULT_MAX_TOKENS}`}
{...field}
onChange={(e) => field.onChange(e.target.valueAsNumber)}
onChange={(e) => {
field.onChange(e.target.valueAsNumber);
}}
/>
</FormControl>
<FormMessage />
Expand Down
5 changes: 3 additions & 2 deletions apps/client/src/services/openai/change-tone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import { t } from "@lingui/macro";

import { openai } from "./client";
import { useOpenAiStore } from "@/client/stores/openai";
import { DEFAULT_MAX_TOKENS, DEFAULT_MODEL } from "@/client/constants/llm";
import { useOpenAiStore } from "@/client/stores/openai";

import { openai } from "./client";

const PROMPT = `You are an AI writing assistant specialized in writing copy for resumes.
Do not return anything else except the text you improved. It should not begin with a newline. It should not have any prefix or suffix text.
Expand Down
2 changes: 1 addition & 1 deletion apps/client/src/services/openai/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const openai = () => {
);
}

if(baseURL) {
if (baseURL) {
return new OpenAI({
baseURL,
apiKey,
Expand Down
5 changes: 3 additions & 2 deletions apps/client/src/services/openai/fix-grammar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import { t } from "@lingui/macro";

import { openai } from "./client";
import { useOpenAiStore } from "@/client/stores/openai";
import { DEFAULT_MAX_TOKENS, DEFAULT_MODEL } from "@/client/constants/llm";
import { useOpenAiStore } from "@/client/stores/openai";

import { openai } from "./client";

const PROMPT = `You are an AI writing assistant specialized in writing copy for resumes.
Do not return anything else except the text you improved. It should not begin with a newline. It should not have any prefix or suffix text.
Expand Down
5 changes: 3 additions & 2 deletions apps/client/src/services/openai/improve-writing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@

import { t } from "@lingui/macro";

import { openai } from "./client";
import { useOpenAiStore } from "@/client/stores/openai";
import { DEFAULT_MAX_TOKENS, DEFAULT_MODEL } from "@/client/constants/llm";
import { useOpenAiStore } from "@/client/stores/openai";

import { openai } from "./client";

const PROMPT = `You are an AI writing assistant specialized in writing copy for resumes.
Do not return anything else except the text you improved. It should not begin with a newline. It should not have any prefix or suffix text.
Expand Down
1 change: 1 addition & 0 deletions apps/client/src/stores/openai.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { create } from "zustand";
import { persist } from "zustand/middleware";

import { DEFAULT_MAX_TOKENS, DEFAULT_MODEL } from "../constants/llm";

type OpenAIStore = {
Expand Down

0 comments on commit 02ce1ad

Please sign in to comment.