diff --git a/packages/xgen/components/edit/CodeEditor/index.less b/packages/xgen/components/edit/CodeEditor/index.less index 2f35c05d..23e5c962 100644 --- a/packages/xgen/components/edit/CodeEditor/index.less +++ b/packages/xgen/components/edit/CodeEditor/index.less @@ -1,4 +1,10 @@ +.editor { + width: 100%; + height: 100%; + position: relative; +} + ._local { - border-radius: var(--radius) !important; - overflow: hidden; -} \ No newline at end of file + width: 100%; + height: 100%; +} diff --git a/packages/xgen/components/edit/CodeEditor/index.tsx b/packages/xgen/components/edit/CodeEditor/index.tsx index e01ce0b8..2a5b3434 100644 --- a/packages/xgen/components/edit/CodeEditor/index.tsx +++ b/packages/xgen/components/edit/CodeEditor/index.tsx @@ -1,14 +1,10 @@ import { useEffect, useMemo, useRef, useState } from 'react' import Editor from 'react-monaco-editor' - import { Item } from '@/components' import { useGlobal } from '@/context/app' import vars from '@/styles/preset/vars' - import styles from './index.less' - import type { Component } from '@/types' - import yaml from 'js-yaml' import type { EditorDidMount, monaco } from 'react-monaco-editor' import { message } from 'antd' @@ -78,6 +74,23 @@ const Custom = window.$app.memo((props: ICustom) => { setValue(props.value) }, [props.value]) + useEffect(() => { + const resizeObserver = new ResizeObserver(() => { + if (ref.current) { + ref.current.layout() + } + }) + + const container = document.querySelector(`.${styles.editor}`) + if (container) { + resizeObserver.observe(container) + } + + return () => { + resizeObserver.disconnect() + } + }, []) + const onChange = (v: any) => { if (!props.onChange) return props.onChange(v) @@ -121,30 +134,32 @@ const Custom = window.$app.memo((props: ICustom) => { } return ( - +
+ +
) }) diff --git a/packages/xgen/pages/assistants/detail/$.tsx b/packages/xgen/pages/assistants/detail/$.tsx index af02b428..286de185 100644 --- a/packages/xgen/pages/assistants/detail/$.tsx +++ b/packages/xgen/pages/assistants/detail/$.tsx @@ -6,10 +6,11 @@ import type { Assistant } from '@/layouts/components/Neo/components/AIChat/Card' import type { UploadChangeParam } from 'antd/es/upload' import type { UploadFile } from 'antd/es/upload/interface' import Tag from '@/layouts/components/Neo/components/AIChat/Tag' -import BasicInfo from './components/BasicInfo' -import KnowledgeFiles from './components/KnowledgeFiles' +import General from './components/General' +import Files from './components/Files' import Workflow from './components/Workflow' -import CodeEditor from './components/CodeEditor' +import Script from './components/Script' +import Functions from './components/Functions' import styles from './index.less' const AssistantDetail = () => { @@ -108,14 +109,14 @@ const AssistantDetail = () => { const items = [ { - key: 'basic', - label: 'Basic Info', - children: + key: 'general', + label: 'General', + children: }, { key: 'files', - label: 'Knowledge Files', - children: + label: 'Files', + children: }, { key: 'workflow', @@ -123,9 +124,14 @@ const AssistantDetail = () => { children: }, { - key: 'code', - label: 'Code', - children: + key: 'functions', + label: 'Functions', + children: + }, + { + key: 'script', + label: 'Script', + children: