Skip to content

Commit 6de71c2

Browse files
authored
Merge pull request #2878 from Agenta-AI/release/v0.59.11
release/v0.59.11
2 parents efb876b + fcf1ff1 commit 6de71c2

File tree

29 files changed

+261
-88
lines changed

29 files changed

+261
-88
lines changed

api/oss/src/__init__.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,19 @@ async def _get_blocked_emails() -> Set[str]:
158158

159159
async def _is_blocked(email: str) -> bool:
160160
email = email.lower()
161-
if email in await _get_blocked_emails():
161+
domain = email.split("@")[-1] if "@" in email else ""
162+
allowed_domains = env.AGENTA_ALLOWED_DOMAINS
163+
is_domain_allowed = allowed_domains and domain in allowed_domains
164+
165+
if allowed_domains and not is_domain_allowed:
162166
return True
163-
if "@" in email and email.split("@")[-1] in await _get_blocked_domains():
167+
168+
if email and email in await _get_blocked_emails():
164169
return True
170+
171+
if domain and domain in await _get_blocked_domains() and not is_domain_allowed:
172+
return True
173+
165174
return False
166175

167176

api/oss/src/utils/env.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ class EnvironSettings(BaseModel):
8989
for e in (os.getenv("AGENTA_BLOCKED_DOMAINS") or "").split(",")
9090
if e.strip()
9191
}
92+
AGENTA_ALLOWED_DOMAINS: set = {
93+
e.strip().lower()
94+
for e in (os.getenv("AGENTA_ALLOWED_DOMAINS") or "").split(",")
95+
if e.strip()
96+
}
9297

9398
# AGENTA-SPECIFIC (INTERNAL INFRA)
9499
DOCKER_NETWORK_MODE: str = os.getenv("DOCKER_NETWORK_MODE") or "bridge"

api/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "api"
3-
version = "0.59.10"
3+
version = "0.59.11"
44
description = "Agenta API"
55
authors = [
66
{ name = "Mahmoud Mabrouk", email = "mahmoud@agenta.ai" },

docs/docs/self-host/02-configuration.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Optional Agenta-specific configurations:
5555
| `AGENTA_SEND_EMAIL_FROM_ADDRESS` | From address for system emails | `mail@example.com` |
5656
| `AGENTA_API_INTERNAL_URL` | Internal API URL for services | _(empty)_ |
5757
| `AGENTA_SERVICE_MIDDLEWARE_CACHE_ENABLED` | Enable middleware caching in the chat and completion services | `true` |
58+
| `AGENTA_ALLOWED_DOMAINS` | Comma-separated list of email domains allowed to authenticate; when set, all other domains are rejected | _(empty)_ |
5859
| `AGENTA_OTLP_MAX_BATCH_BYTES` | Max OTLP batch size before requests are rejected with 413 | `10485760` (10MB) |
5960

6061
### Third-party (Required)
@@ -238,4 +239,3 @@ TRAEFIK_PORT=80
238239
For configuration assistance:
239240
- Check the [GitHub issues](https://github.com/Agenta-AI/agenta/issues)
240241
- Join our [Slack community](https://join.slack.com/t/agenta-hq/shared_invite/zt-37pnbp5s6-mbBrPL863d_oLB61GSNFjw)
241-
- Review the deployment documentation for your specific setup

sdk/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "agenta"
3-
version = "0.59.10"
3+
version = "0.59.11"
44
description = "The SDK for agenta is an open-source LLMOps platform."
55
readme = "README.md"
66
authors = [

web/ee/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@agenta/ee",
3-
"version": "0.59.10",
3+
"version": "0.59.11",
44
"private": true,
55
"engines": {
66
"node": ">=18"

web/ee/src/components/Evaluators/components/ConfigureEvaluator/index.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,7 @@ const ConfigureEvaluatorPage = ({evaluatorId}: {evaluatorId?: string | null}) =>
103103
const handleSuccess = useCallback(async () => {
104104
message.success("Evaluator configuration saved")
105105
await refetchAll()
106-
await navigateBack()
107-
}, [navigateBack, refetchAll])
106+
}, [refetchAll])
108107

109108
if (!router.isReady || isLoading) {
110109
return <ConfigureEvaluatorSkeleton />

web/ee/src/components/pages/evaluations/autoEvaluation/EvaluatorsModal/ConfigureEvaluator/DynamicFormField.tsx

Lines changed: 82 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
import {useCallback} from "react"
2+
13
import {InfoCircleOutlined} from "@ant-design/icons"
2-
import Editor from "@monaco-editor/react"
34
import {theme, Form, Tooltip, InputNumber, Switch, Input, AutoComplete} from "antd"
4-
import {Rule} from "antd/es/form"
5+
import {FormInstance, Rule} from "antd/es/form"
56
import Link from "next/link"
67
import {createUseStyles} from "react-jss"
78

8-
import {useAppTheme} from "@/oss/components/Layout/ThemeContextProvider"
9+
import SharedEditor from "@/oss/components/Playground/Components/SharedEditor"
910
import {isValidRegex} from "@/oss/lib/helpers/validators"
1011
import {generatePaths} from "@/oss/lib/transformers"
1112
import {EvaluationSettingsTemplate, JSSTheme} from "@/oss/lib/Types"
@@ -15,15 +16,24 @@ import {Messages} from "./Messages"
1516
type DynamicFormFieldProps = EvaluationSettingsTemplate & {
1617
name: string | string[]
1718
traceTree: Record<string, any>
19+
form?: FormInstance<any>
1820
}
1921

2022
const useStyles = createUseStyles((theme: JSSTheme) => ({
21-
editor: {
22-
border: `1px solid ${theme.colorBorder}`,
23-
borderRadius: theme.borderRadius,
24-
overflow: "hidden",
25-
"& .monaco-editor": {
26-
width: "0 !important",
23+
codeEditor: {
24+
"& .agenta-editor-wrapper": {
25+
minHeight: 375,
26+
},
27+
"&.agenta-shared-editor": {
28+
borderColor: theme.colorBorder,
29+
},
30+
},
31+
objectEditor: {
32+
"& .agenta-editor-wrapper": {
33+
minHeight: 120,
34+
},
35+
"&.agenta-shared-editor": {
36+
borderColor: theme.colorBorder,
2737
},
2838
},
2939
ExternalHelp: {
@@ -45,6 +55,41 @@ const useStyles = createUseStyles((theme: JSSTheme) => ({
4555
},
4656
}))
4757

58+
interface ControlledSharedEditorProps {
59+
value?: unknown
60+
onChange?: (value: string) => void
61+
className?: string
62+
language?: "json" | "yaml" | "code"
63+
}
64+
65+
const ControlledSharedEditor = ({
66+
value,
67+
onChange,
68+
className,
69+
language,
70+
}: ControlledSharedEditorProps) => {
71+
const handleValueChange = useCallback(
72+
(next: string) => {
73+
onChange?.(next)
74+
},
75+
[onChange],
76+
)
77+
78+
return (
79+
<SharedEditor
80+
initialValue={value}
81+
value={value as string}
82+
handleChange={handleValueChange}
83+
className={className}
84+
syncWithInitialValueChanges
85+
editorProps={{
86+
codeOnly: true,
87+
...(language ? {language} : {}),
88+
}}
89+
/>
90+
)
91+
}
92+
4893
export const DynamicFormField: React.FC<DynamicFormFieldProps> = ({
4994
name,
5095
label,
@@ -55,11 +100,24 @@ export const DynamicFormField: React.FC<DynamicFormFieldProps> = ({
55100
max,
56101
required,
57102
traceTree,
103+
form,
58104
}) => {
59-
const {appTheme} = useAppTheme()
105+
const settingsValue = Form.useWatch(name, form)
106+
60107
const classes = useStyles()
61108
const {token} = theme.useToken()
62109

110+
const handleValueChange = useCallback(
111+
(next: string) => {
112+
if (form) {
113+
form.setFieldsValue({
114+
[name as string]: next,
115+
})
116+
}
117+
},
118+
[form, name],
119+
)
120+
63121
const rules: Rule[] = [{required: required ?? true, message: "This field is required"}]
64122
if (type === "regex")
65123
rules.push({
@@ -100,7 +158,11 @@ export const DynamicFormField: React.FC<DynamicFormFieldProps> = ({
100158
)}
101159
</div>
102160
}
103-
initialValue={defaultVal}
161+
initialValue={
162+
type === "object" && defaultVal && typeof defaultVal === "object"
163+
? JSON.stringify(defaultVal, null, 2)
164+
: defaultVal
165+
}
104166
rules={rules}
105167
hidden={type === "hidden"}
106168
>
@@ -126,21 +188,18 @@ export const DynamicFormField: React.FC<DynamicFormFieldProps> = ({
126188
) : type === "text" ? (
127189
<Input.TextArea rows={10} />
128190
) : type === "code" ? (
129-
<Editor
130-
className={classes.editor}
131-
height={375}
132-
width="100%"
133-
language="python"
134-
theme={`vs-${appTheme}`}
191+
<ControlledSharedEditor
192+
className={classes.codeEditor}
193+
value={settingsValue}
194+
onChange={handleValueChange}
195+
language="code"
135196
/>
136197
) : type === "object" ? (
137-
<Editor
138-
className={classes.editor}
139-
height={120}
140-
width="100%"
198+
<ControlledSharedEditor
199+
className={classes.objectEditor}
141200
language="json"
142-
options={{lineNumbers: "off"}}
143-
theme={`vs-${appTheme}`}
201+
value={settingsValue}
202+
onChange={handleValueChange}
144203
/>
145204
) : null}
146205
</Form.Item>

web/ee/src/components/pages/evaluations/autoEvaluation/EvaluatorsModal/ConfigureEvaluator/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ const ConfigureEvaluator = ({
244244
{...field}
245245
key={field.key}
246246
traceTree={traceTree}
247+
form={form}
247248
name={["settings_values", field.key]}
248249
/>
249250
))}

web/oss/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@agenta/oss",
3-
"version": "0.59.10",
3+
"version": "0.59.11",
44
"private": true,
55
"engines": {
66
"node": ">=18"

0 commit comments

Comments
 (0)