[WEB-4146] fix: AI environment variables configuration in GodMode (#7104)
* [WEB-4146] fix: artificial intelligence environment variables configuration * chore: update llm configuration keys
This commit is contained in:
parent
9812129ad3
commit
6216ad77f4
5 changed files with 16 additions and 16 deletions
|
|
@ -26,16 +26,16 @@ export const InstanceAIForm: FC<IInstanceAIForm> = (props) => {
|
|||
formState: { errors, isSubmitting },
|
||||
} = useForm<AIFormValues>({
|
||||
defaultValues: {
|
||||
OPENAI_API_KEY: config["OPENAI_API_KEY"],
|
||||
GPT_ENGINE: config["GPT_ENGINE"],
|
||||
LLM_API_KEY: config["LLM_API_KEY"],
|
||||
LLM_MODEL: config["LLM_MODEL"],
|
||||
},
|
||||
});
|
||||
|
||||
const aiFormFields: TControllerInputFormField[] = [
|
||||
{
|
||||
key: "GPT_ENGINE",
|
||||
key: "LLM_MODEL",
|
||||
type: "text",
|
||||
label: "GPT_ENGINE",
|
||||
label: "LLM Model",
|
||||
description: (
|
||||
<>
|
||||
Choose an OpenAI engine.{" "}
|
||||
|
|
@ -49,12 +49,12 @@ export const InstanceAIForm: FC<IInstanceAIForm> = (props) => {
|
|||
</a>
|
||||
</>
|
||||
),
|
||||
placeholder: "gpt-3.5-turbo",
|
||||
error: Boolean(errors.GPT_ENGINE),
|
||||
placeholder: "gpt-4o-mini",
|
||||
error: Boolean(errors.LLM_MODEL),
|
||||
required: false,
|
||||
},
|
||||
{
|
||||
key: "OPENAI_API_KEY",
|
||||
key: "LLM_API_KEY",
|
||||
type: "password",
|
||||
label: "API key",
|
||||
description: (
|
||||
|
|
@ -71,7 +71,7 @@ export const InstanceAIForm: FC<IInstanceAIForm> = (props) => {
|
|||
</>
|
||||
),
|
||||
placeholder: "sk-asddassdfasdefqsdfasd23das3dasdcasd",
|
||||
error: Boolean(errors.OPENAI_API_KEY),
|
||||
error: Boolean(errors.LLM_API_KEY),
|
||||
required: false,
|
||||
},
|
||||
];
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ class InstanceEndpoint(BaseAPIView):
|
|||
POSTHOG_API_KEY,
|
||||
POSTHOG_HOST,
|
||||
UNSPLASH_ACCESS_KEY,
|
||||
OPENAI_API_KEY,
|
||||
LLM_API_KEY,
|
||||
IS_INTERCOM_ENABLED,
|
||||
INTERCOM_APP_ID,
|
||||
) = get_configuration_value(
|
||||
|
|
@ -112,8 +112,8 @@ class InstanceEndpoint(BaseAPIView):
|
|||
"default": os.environ.get("UNSPLASH_ACCESS_KEY", ""),
|
||||
},
|
||||
{
|
||||
"key": "OPENAI_API_KEY",
|
||||
"default": os.environ.get("OPENAI_API_KEY", ""),
|
||||
"key": "LLM_API_KEY",
|
||||
"default": os.environ.get("LLM_API_KEY", ""),
|
||||
},
|
||||
# Intercom settings
|
||||
{
|
||||
|
|
@ -151,7 +151,7 @@ class InstanceEndpoint(BaseAPIView):
|
|||
data["has_unsplash_configured"] = bool(UNSPLASH_ACCESS_KEY)
|
||||
|
||||
# Open AI settings
|
||||
data["has_openai_configured"] = bool(OPENAI_API_KEY)
|
||||
data["has_llm_configured"] = bool(LLM_API_KEY)
|
||||
|
||||
# File size settings
|
||||
data["file_size_limit"] = float(os.environ.get("FILE_SIZE_LIMIT", 5242880))
|
||||
|
|
|
|||
2
packages/types/src/instance/ai.d.ts
vendored
2
packages/types/src/instance/ai.d.ts
vendored
|
|
@ -1 +1 @@
|
|||
export type TInstanceAIConfigurationKeys = "OPENAI_API_KEY" | "GPT_ENGINE";
|
||||
export type TInstanceAIConfigurationKeys = "LLM_API_KEY" | "LLM_MODEL";
|
||||
|
|
|
|||
2
packages/types/src/instance/base.d.ts
vendored
2
packages/types/src/instance/base.d.ts
vendored
|
|
@ -49,7 +49,7 @@ export interface IInstanceConfig {
|
|||
posthog_api_key: string | undefined;
|
||||
posthog_host: string | undefined;
|
||||
has_unsplash_configured: boolean;
|
||||
has_openai_configured: boolean;
|
||||
has_llm_configured: boolean;
|
||||
file_size_limit: number | undefined;
|
||||
is_smtp_configured: boolean;
|
||||
app_base_url: string | undefined;
|
||||
|
|
|
|||
|
|
@ -225,7 +225,7 @@ export const IssueDescriptionEditor: React.FC<TIssueDescriptionEditorProps> = ob
|
|||
)}
|
||||
/>
|
||||
<div className="border-0.5 z-10 flex items-center justify-end gap-2 p-3">
|
||||
{issueName && issueName.trim() !== "" && config?.has_openai_configured && (
|
||||
{issueName && issueName.trim() !== "" && config?.has_llm_configured && (
|
||||
<button
|
||||
type="button"
|
||||
className={`flex items-center gap-1 rounded bg-custom-background-90 hover:bg-custom-background-80 px-1.5 py-1 text-xs ${
|
||||
|
|
@ -244,7 +244,7 @@ export const IssueDescriptionEditor: React.FC<TIssueDescriptionEditorProps> = ob
|
|||
)}
|
||||
</button>
|
||||
)}
|
||||
{config?.has_openai_configured && projectId && (
|
||||
{config?.has_llm_configured && projectId && (
|
||||
<GptAssistantPopover
|
||||
isOpen={gptAssistantModal}
|
||||
handleClose={() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue