diff --git a/.env.example b/.env.example index 7608d59a..f8140657 100644 --- a/.env.example +++ b/.env.example @@ -85,7 +85,9 @@ LITELLM_MODEL=gpt-4o-mini # Extension: openai_chatgpt # OpenAI API key +OPENAI_API_BASE=https://api.openai.com/v1 OPENAI_API_KEY= +OPENAI_MODEL=gpt-4o-mini # OpenAI API key for realtime API OPENAI_REALTIME_API_KEY= diff --git a/agents/property.json b/agents/property.json index 9f2a2867..dbd877b6 100644 --- a/agents/property.json +++ b/agents/property.json @@ -154,15 +154,15 @@ "extension_group": "chatgpt", "name": "openai_chatgpt", "property": { - "api_key": "$OPENAI_API_KEY", - "base_url": "", + "api_key": "${env:OPENAI_API_KEY}", + "base_url": "${env:OPENAI_API_BASE}", "frequency_penalty": 0.9, "greeting": "TEN Agent connected. How can I help you today?", "max_memory_length": 10, "max_tokens": 512, - "model": "gpt-4o-mini", + "model": "${env:OPENAI_MODEL}", "prompt": "", - "proxy_url": "$OPENAI_PROXY_URL" + "proxy_url": "${env:OPENAI_PROXY_URL}" }, "type": "extension" }, @@ -236,10 +236,10 @@ "addon": "openai_chatgpt", "name": "openai_chatgpt", "property": { - "base_url": "", + "base_url": "${env:OPENAI_API_BASE}", "api_key": "${env:OPENAI_API_KEY}", "frequency_penalty": 0.9, - "model": "gpt-4o-mini", + "model": "${env:OPENAI_MODEL}", "max_tokens": 512, "prompt": "", "proxy_url": "${env:OPENAI_PROXY_URL}", @@ -415,10 +415,10 @@ "addon": "openai_chatgpt", "name": "openai_chatgpt", "property": { - "base_url": "", + "base_url": "${env:OPENAI_API_BASE}", "api_key": "${env:OPENAI_API_KEY}", "frequency_penalty": 0.9, - "model": "gpt-4o-mini", + "model": "${env:OPENAI_MODEL}", "max_tokens": 512, "prompt": "", "proxy_url": "${env:OPENAI_PROXY_URL}", @@ -600,10 +600,10 @@ "addon": "openai_chatgpt", "name": "openai_chatgpt", "property": { - "base_url": "", + "base_url": "${env:OPENAI_API_BASE}", "api_key": "${env:OPENAI_API_KEY}", "frequency_penalty": 0.9, - "model": "gpt-4o-mini", + "model": "${env:OPENAI_MODEL}", "max_tokens": 512, "prompt": "", "proxy_url": "${env:OPENAI_PROXY_URL}", @@ -924,10 +924,10 @@ "addon": "openai_chatgpt_python", "name": "openai_chatgpt", "property": { - "base_url": "", + "base_url": "${env:OPENAI_API_BASE}", "api_key": "${env:OPENAI_API_KEY}", "frequency_penalty": 0.9, - "model": "gpt-4o-mini", + "model": "${env:OPENAI_MODEL}", "max_tokens": 512, "prompt": "", "proxy_url": "${env:OPENAI_PROXY_URL}", @@ -1678,10 +1678,10 @@ "addon": "openai_chatgpt_python", "name": "openai_chatgpt", "property": { - "base_url": "", + "base_url": "${env:OPENAI_API_BASE}", "api_key": "${env:OPENAI_API_KEY}", "frequency_penalty": 0.9, - "model": "gpt-4o", + "model": "${env:OPENAI_MODEL}", "max_tokens": 512, "prompt": "", "proxy_url": "${env:OPENAI_PROXY_URL}", diff --git a/playground/src/platform/pc/chat/table/index.tsx b/playground/src/platform/pc/chat/table/index.tsx index 78465a40..1b9f43db 100644 --- a/playground/src/platform/pc/chat/table/index.tsx +++ b/playground/src/platform/pc/chat/table/index.tsx @@ -55,16 +55,16 @@ const EditableTable: React.FC = ({ initialData, onUpdate, me const row = await form.validateFields(); const newData = [...dataSource]; const index = newData.findIndex((item) => key === item.key); - + if (index > -1) { const item = newData[index]; const valueType = metadata[key]?.type || 'string'; const updatedValue = row.value === '' ? null : convertToType(row.value, valueType); // Set to null if empty - + newData.splice(index, 1, { ...item, value: updatedValue }); setDataSource(newData); setEditingKey(''); - + // Notify the parent component of the update const updatedData = Object.fromEntries(newData.map(({ key, value }) => [key, value])); onUpdate(updatedData); @@ -72,8 +72,8 @@ const EditableTable: React.FC = ({ initialData, onUpdate, me } catch (errInfo) { console.log('Validation Failed:', errInfo); } - }; - + }; + // Toggle the checkbox for boolean values directly in the table cell const handleCheckboxChange = (key: string, checked: boolean) => { @@ -111,7 +111,7 @@ const EditableTable: React.FC = ({ initialData, onUpdate, me key: 'value', render: (_, record: DataType) => { const valueType = metadata[record.key]?.type || 'string'; - + // Always display the checkbox for boolean values if (valueType === 'bool') { return ( @@ -121,7 +121,7 @@ const EditableTable: React.FC = ({ initialData, onUpdate, me /> ); } - + // Inline editing for other types (string, number) const editable = isEditing(record); return editable ? ( @@ -137,13 +137,13 @@ const EditableTable: React.FC = ({ initialData, onUpdate, me ) : (
edit(record)} style={{ cursor: 'pointer' }}> - {record.value !== null && record.value !== undefined && record.value !== '' - ? record.value + {record.value != null && String(record.value).trim() !== '' + ? String(record.value) : Click to edit}
); }, - }, + }, ]; return (