JiuwenSwarm is an intelligent AI Agent built on openJiuwen. It extends the powerful capabilities of large language models directly to your fingertips through various communication apps you use daily.
Python
fix(web-frontend): support utf-16 file compile & remove agent max_iterations config
openJiuwen-botfabbf12bef03
diff --git a/jiuwenswarm/channels/web/frontend/src/App.tsx b/jiuwenswarm/channels/web/frontend/src/App.tsxindex 3d726697f3..de7e4d7cc4 100644--- a/jiuwenswarm/channels/web/frontend/src/App.tsx+++ b/jiuwenswarm/channels/web/frontend/src/App.tsx@@ -48,7 +48,6 @@ type AgentsTeamsSavePayload = {agents: Record<string, {model: { provider: string; api_base: string; api_key: string; model: string };skills: string[];- max_iterations: number;completion_timeout: number;}>;team: Array<{@@ -471,7 +470,7 @@ function AppContent() {}}, [clearRestartAutoCloseTimer, closeRestartModal, request]);- const applyConfigSaveUiState = useCallback((appliedWithoutRestart: boolean) => {+const applyConfigSaveUiState = useCallback((appliedWithoutRestart: boolean) => {setConfigError(null);setRestartModalOpen(true);setRestartSuccess(false);@@ -492,7 +491,6 @@ function AppContent() {updates[`agent_name_${idx}`] = name;updates[`agent_model_${idx}`] = agent.model.model;updates[`agent_skills_${idx}`] = agent.skills.join(',');- updates[`agent_max_iterations_${idx}`] = String(agent.max_iterations);updates[`agent_completion_timeout_${idx}`] = String(agent.completion_timeout);});payload.team.forEach((team, idx) => {diff --git a/jiuwenswarm/channels/web/frontend/src/components/AgentPanel/FileViewer.tsx b/jiuwenswarm/channels/web/frontend/src/components/AgentPanel/FileViewer.tsxindex 8d8b28ebb6..0742037f5a 100644--- a/jiuwenswarm/channels/web/frontend/src/components/AgentPanel/FileViewer.tsx+++ b/jiuwenswarm/channels/web/frontend/src/components/AgentPanel/FileViewer.tsx@@ -267,6 +267,9 @@ export function FileViewer({ filePath, fileName, reloadNonce = 0 }: FileViewerPr><option value="auto">Auto Detect</option><option value="utf-8">UTF-8</option>+ <option value="utf-16">UTF-16</option>+ <option value="utf-16le">UTF-16LE</option>+ <option value="utf-16be">UTF-16BE</option><option value="gbk">GBK</option><option value="gb2312">GB2312</option><option value="big5">Big5</option>diff --git a/jiuwenswarm/channels/web/frontend/src/components/ConfigPanel/index.tsx b/jiuwenswarm/channels/web/frontend/src/components/ConfigPanel/index.tsxindex df99fcbfc4..4e2d3c1a4e 100644--- a/jiuwenswarm/channels/web/frontend/src/components/ConfigPanel/index.tsx+++ b/jiuwenswarm/channels/web/frontend/src/components/ConfigPanel/index.tsx@@ -102,7 +102,6 @@ interface AgentEntry {name: string;model: AgentModel;skills: string[];- max_iterations: number;completion_timeout: number;}@@ -158,7 +157,6 @@ interface ConfigPanelProps {agents: Record<string, {model: { provider: string; api_base: string; api_key: string; model: string };skills: string[];- max_iterations: number;completion_timeout: number;}>;team: Array<{@@ -177,7 +175,6 @@ interface AgentsTeamsPayload {agents: Record<string, {model: { provider: string; api_base: string; api_key: string; model: string };skills: string[];- max_iterations: number;completion_timeout: number;}>;team: Array<{@@ -251,7 +248,7 @@ function getFieldLengthErrorKey(field: keyof ModelEntry, value: string): stringreturn null;}}-const AGENT_KEYS = new Set(["name", "model", "skills", "max_iterations", "completion_timeout"]);+const AGENT_KEYS = new Set(["name", "model", "skills", "completion_timeout"]);const TEAM_KEYS = new Set(["team_name", "lifecycle", "teammate_mode", "spawn_mode"]);const FREE_SEARCH_BOOLEAN_KEYS = new Set(["free_search_ddg_enabled", "free_search_bing_enabled"]);const FREE_SEARCH_KEYS = new Set([...FREE_SEARCH_BOOLEAN_KEYS]);@@ -486,7 +483,6 @@ const KEY_DISPLAY_I18N: Record<string, string> = {name: "config.keys.agentName",model: "config.keys.agentModel",skills: "config.keys.agentSkills",- max_iterations: "config.keys.agentMaxIterations",completion_timeout: "config.keys.agentCompletionTimeout",};const KEY_PLACEHOLDER_I18N: Record<string, string> = {@@ -506,7 +502,6 @@ const KEY_SORT_PRIORITY: Record<string, number> = {memory_forbidden_description: 1,model: 0,skills: 1,- max_iterations: 2,completion_timeout: 3,};@@ -1226,7 +1221,6 @@ function MultiAgentSection({name: "",model: { provider: "", api_base: "", api_key: "", model: "" },skills: [],- max_iterations: 200,completion_timeout: 600,});@@ -1351,17 +1345,16 @@ function MultiAgentSection({onAgentsChange([...agents, { ...newAgent, name }]);setExpandedIdx(agents.length);setAddingNew(false);- setNewAgent({ name: "", model: { provider: "", api_base: "", api_key: "", model: "" }, skills: [], max_iterations: 200, completion_timeout: 600 });+ setNewAgent({ name: "", model: { provider: "", api_base: "", api_key: "", model: "" }, skills: [], completion_timeout: 600 });};- const agentFields: (keyof AgentEntry)[] = ["name", "skills", "max_iterations", "completion_timeout"];+ const agentFields: (keyof AgentEntry)[] = ["name", "skills", "completion_timeout"];const getAgentFieldLabel = (field: string): string => {const labels: Record<string, string> = {name: t("config.keys.agentName"),model: t("config.keys.agentModel"),skills: t("config.keys.agentSkills"),- max_iterations: t("config.keys.agentMaxIterations"),completion_timeout: t("config.keys.agentCompletionTimeout"),};return labels[field] || field;@@ -1443,18 +1436,6 @@ function MultiAgentSection({}}placeholder={t("config.keys.agentSkillsPlaceholder")}/>- ) : field === "max_iterations" ? (- <input- type="number"- step="1"- min="1"- value={agent[field] ?? 1}- onChange={(e) => {- const v = parseInt(e.target.value.replace(/^0+/, '') || '1');- updateAgentField(idx, field, v > 0 ? v : 1);- }}- className="flex-1 rounded border border-border bg-bg px-2 py-1 text-text text-xs"- />) : field === "completion_timeout" ? (<inputtype="number"@@ -1550,18 +1531,6 @@ function MultiAgentSection({onChange={(selected) => setNewAgent((p) => ({ ...p, skills: selected }))}placeholder={t("config.keys.agentSkillsPlaceholder")}/>- ) : field === "max_iterations" ? (- <input- type="number"- step="1"- min="1"- value={newAgent[field] ?? 1}- onChange={(e) => {- const v = parseInt(e.target.value.replace(/^0+/, '') || '1');- setNewAgent((p) => ({ ...p, [field]: v > 0 ? v : 1 }));- }}- className="flex-1 rounded border border-border bg-bg px-2 py-1 text-text text-xs"- />) : field === "completion_timeout" ? (<inputtype="number"@@ -2467,7 +2436,6 @@ export function ConfigPanel({model: matchedModel.model_name || "",} : { provider: "", api_base: "", api_key: "", model: modelName },skills: (normalizedConfig[`agent_skills_${i}`] || normalizedConfig[`agent_${i}_skills`] || "").split(/[,,]/).map((s: string) => s.trim()).filter(Boolean),- max_iterations: Math.max(1, Number(normalizedConfig[`agent_max_iterations_${i}`]) || Number(normalizedConfig[`agent_${i}_max_iterations`]) || 200),completion_timeout: Number(normalizedConfig[`agent_completion_timeout_${i}`]) || Number(normalizedConfig[`agent_${i}_completion_timeout`]) || 600,});}@@ -2779,7 +2747,6 @@ export function ConfigPanel({agentsPayload[agent.name] = {model: { ...agent.model },skills: agent.skills,- max_iterations: agent.max_iterations,completion_timeout: agent.completion_timeout,};}@@ -2938,14 +2905,14 @@ export function ConfigPanel({type="button"onClick={handleCancel}disabled={!hasChanges || saving}- className="btn !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed"+ className="btn !px-3 !py-1.5 disabled:cursor-not-allowed">{t('common.cancel')}</button><buttontype="button"onClick={() => void handleSaveAndRestart()}- disabled={!hasChanges || saving || hasMissingRequiredModelFields || hasMissingModelApiKey || hasMissingModelApiBase || agentModelReferencesLost.length > 0 || (isProcessing && mode !== 'team')}+ disabled={!hasChanges || saving || hasMissingRequiredModelFields || hasMissingModelApiKey || hasMissingModelApiBase || agentModelReferencesLost.length > 0 || hasAgentsTeamsValidationError || (isProcessing && mode !== 'team')}className="btn primary !px-3 !py-1.5 disabled:opacity-50 disabled:cursor-not-allowed">{saving ? t('common.saving') : t('common.save')}diff --git a/jiuwenswarm/channels/web/frontend/src/components/ToolPanel/ReadOnlyFileModal.tsx b/jiuwenswarm/channels/web/frontend/src/components/ToolPanel/ReadOnlyFileModal.tsxindex b2f8f8fb0e..d5533a5a8a 100644--- a/jiuwenswarm/channels/web/frontend/src/components/ToolPanel/ReadOnlyFileModal.tsx+++ b/jiuwenswarm/channels/web/frontend/src/components/ToolPanel/ReadOnlyFileModal.tsx@@ -187,6 +187,9 @@ export function ReadOnlyFileModal({ open, filePath, fileName, onClose }: ReadOnl><option value="auto">Auto Detect</option><option value="utf-8">UTF-8</option>+ <option value="utf-16">UTF-16</option>+ <option value="utf-16le">UTF-16LE</option>+ <option value="utf-16be">UTF-16BE</option><option value="gbk">GBK</option><option value="gb2312">GB2312</option><option value="big5">Big5</option>diff --git a/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json b/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.jsonindex 574e7e0a67..4b48c954e1 100644--- a/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json+++ b/jiuwenswarm/channels/web/frontend/src/i18n/locales/en.json@@ -535,7 +535,6 @@"agentName": "Name","agentModel": "Model","agentSkills": "Skills",- "agentMaxIterations": "Max Iterations","agentCompletionTimeout": "Completion Timeout","teamName": "Team Name","teamLifecycle": "Lifecycle",diff --git a/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json b/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.jsonindex 47417b5775..b0637e5e8f 100644--- a/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json+++ b/jiuwenswarm/channels/web/frontend/src/i18n/locales/zh.json@@ -534,7 +534,6 @@"agentName": "名称","agentModel": "模型","agentSkills": "技能",- "agentMaxIterations": "最大迭代次数","agentCompletionTimeout": "完成超时时间","teamName": "团队名称","teamLifecycle": "生命周期",