|
@@ -14,7 +14,7 @@ import { useTabs } from "@/context/tabs"
|
|
|
import { paasRecord, paasStatus, paasStatuses, paasText } from "@/paas"
|
|
import { paasRecord, paasStatus, paasStatuses, paasText } from "@/paas"
|
|
|
import { showToast } from "@/utils/toast"
|
|
import { showToast } from "@/utils/toast"
|
|
|
import { createPaasWorkspace } from "./controller"
|
|
import { createPaasWorkspace } from "./controller"
|
|
|
-import { personalDeployment } from "./deployment"
|
|
|
|
|
|
|
+import { personalDeployment, type PaasDeploymentProfile } from "./deployment"
|
|
|
import {
|
|
import {
|
|
|
clampNavWidth,
|
|
clampNavWidth,
|
|
|
clampPreviewWidth,
|
|
clampPreviewWidth,
|
|
@@ -69,11 +69,13 @@ function agentInitial(agent: Record<string, unknown>) {
|
|
|
export default function PaasWorkspace(
|
|
export default function PaasWorkspace(
|
|
|
props: {
|
|
props: {
|
|
|
standalone?: boolean
|
|
standalone?: boolean
|
|
|
|
|
+ deployment?: PaasDeploymentProfile
|
|
|
onOpenDeveloper?: (directory?: string) => void
|
|
onOpenDeveloper?: (directory?: string) => void
|
|
|
registerMenuCommand?: (handler: ((id: string) => boolean) | undefined) => void
|
|
registerMenuCommand?: (handler: ((id: string) => boolean) | undefined) => void
|
|
|
} = {},
|
|
} = {},
|
|
|
) {
|
|
) {
|
|
|
const platform = usePlatform()
|
|
const platform = usePlatform()
|
|
|
|
|
+ const deployment = () => props.deployment ?? personalDeployment
|
|
|
const dialog = useDialog()
|
|
const dialog = useDialog()
|
|
|
const global = props.standalone ? undefined : useGlobal()
|
|
const global = props.standalone ? undefined : useGlobal()
|
|
|
const server = props.standalone ? undefined : useServer()
|
|
const server = props.standalone ? undefined : useServer()
|
|
@@ -82,7 +84,7 @@ export default function PaasWorkspace(
|
|
|
const navigate = props.standalone ? undefined : useNavigate()
|
|
const navigate = props.standalone ? undefined : useNavigate()
|
|
|
const drafts = new Map<string, AgentEditDraft>()
|
|
const drafts = new Map<string, AgentEditDraft>()
|
|
|
const workspace = createPaasWorkspace(platform.paas, {
|
|
const workspace = createPaasWorkspace(platform.paas, {
|
|
|
- permissionsDefault: personalDeployment.permissionsDefault,
|
|
|
|
|
|
|
+ permissionsDefault: deployment().permissionsDefault,
|
|
|
})
|
|
})
|
|
|
const state = workspace.state
|
|
const state = workspace.state
|
|
|
const disabled = () => !!state.busy || !state.connected
|
|
const disabled = () => !!state.busy || !state.connected
|
|
@@ -283,6 +285,10 @@ export default function PaasWorkspace(
|
|
|
() => setUI({ notices: [], chatTask: undefined, management: "" }),
|
|
() => setUI({ notices: [], chatTask: undefined, management: "" }),
|
|
|
),
|
|
),
|
|
|
)
|
|
)
|
|
|
|
|
+ createEffect(() => {
|
|
|
|
|
+ const url = deployment().platformUrl
|
|
|
|
|
+ if (url && !state.connected) workspace.setState("url", url)
|
|
|
|
|
+ })
|
|
|
createEffect(
|
|
createEffect(
|
|
|
on(
|
|
on(
|
|
|
() => state.page,
|
|
() => state.page,
|
|
@@ -906,7 +912,11 @@ export default function PaasWorkspace(
|
|
|
<section class="paas-panel paas-connect paas-connection-page" aria-label="平台连接">
|
|
<section class="paas-panel paas-connect paas-connection-page" aria-label="平台连接">
|
|
|
<div>
|
|
<div>
|
|
|
<strong>{state.connected ? "连接信息" : "连接你的 AgentPaaS"}</strong>
|
|
<strong>{state.connected ? "连接信息" : "连接你的 AgentPaaS"}</strong>
|
|
|
- <p>填写管理员提供的平台地址与访问凭证,即可开始研究。已有本机平台服务可直接一键连接。</p>
|
|
|
|
|
|
|
+ <p>
|
|
|
|
|
+ {deployment().allowCustomPlatform
|
|
|
|
|
+ ? "填写管理员提供的平台地址与访问凭证,即可开始研究。已有本机平台服务可直接一键连接。"
|
|
|
|
|
+ : "平台地址已由部署预置,请填写访问凭证后连接。"}
|
|
|
|
|
+ </p>
|
|
|
<p class="paas-muted">桌面端不会自动安装平台服务。记住连接后,下次打开可自动进入工作台。</p>
|
|
<p class="paas-muted">桌面端不会自动安装平台服务。记住连接后,下次打开可自动进入工作台。</p>
|
|
|
<p class="paas-muted">
|
|
<p class="paas-muted">
|
|
|
连接成功表示平台目录可访问;执行服务和模型是否可用,可在“资源检查”中进一步确认。
|
|
连接成功表示平台目录可访问;执行服务和模型是否可用,可在“资源检查”中进一步确认。
|
|
@@ -945,10 +955,14 @@ export default function PaasWorkspace(
|
|
|
type="url"
|
|
type="url"
|
|
|
required
|
|
required
|
|
|
value={state.url}
|
|
value={state.url}
|
|
|
|
|
+ readOnly={!deployment().allowCustomPlatform}
|
|
|
disabled={!!state.busy}
|
|
disabled={!!state.busy}
|
|
|
onInput={(event) => workspace.setState("url", event.currentTarget.value)}
|
|
onInput={(event) => workspace.setState("url", event.currentTarget.value)}
|
|
|
placeholder="https://paas.example.com"
|
|
placeholder="https://paas.example.com"
|
|
|
/>
|
|
/>
|
|
|
|
|
+ <Show when={!deployment().allowCustomPlatform}>
|
|
|
|
|
+ <small class="paas-muted">平台地址由部署预置,不能修改。</small>
|
|
|
|
|
+ </Show>
|
|
|
</label>
|
|
</label>
|
|
|
<label>
|
|
<label>
|
|
|
API Key
|
|
API Key
|
|
@@ -973,13 +987,15 @@ export default function PaasWorkspace(
|
|
|
<button class="paas-primary" type="submit" disabled={!platform.paas || !!state.busy}>
|
|
<button class="paas-primary" type="submit" disabled={!platform.paas || !!state.busy}>
|
|
|
连接平台
|
|
连接平台
|
|
|
</button>
|
|
</button>
|
|
|
- <button
|
|
|
|
|
- type="button"
|
|
|
|
|
- disabled={!platform.paas || !!state.busy}
|
|
|
|
|
- onClick={() => void workspace.connect(true)}
|
|
|
|
|
- >
|
|
|
|
|
- 一键连接本机
|
|
|
|
|
- </button>
|
|
|
|
|
|
|
+ <Show when={deployment().allowCustomPlatform}>
|
|
|
|
|
+ <button
|
|
|
|
|
+ type="button"
|
|
|
|
|
+ disabled={!platform.paas || !!state.busy}
|
|
|
|
|
+ onClick={() => void workspace.connect(true)}
|
|
|
|
|
+ >
|
|
|
|
|
+ 一键连接本机
|
|
|
|
|
+ </button>
|
|
|
|
|
+ </Show>
|
|
|
</form>
|
|
</form>
|
|
|
</Show>
|
|
</Show>
|
|
|
</section>
|
|
</section>
|
|
@@ -1179,6 +1195,7 @@ export default function PaasWorkspace(
|
|
|
<PaasAgentEdit
|
|
<PaasAgentEdit
|
|
|
api={api}
|
|
api={api}
|
|
|
agentID={ui.editAgentID}
|
|
agentID={ui.editAgentID}
|
|
|
|
|
+ modelPolicy={deployment().modelPolicy}
|
|
|
draft={drafts.get(`${state.scope}:${ui.editAgentID}`)}
|
|
draft={drafts.get(`${state.scope}:${ui.editAgentID}`)}
|
|
|
onDraft={(() => {
|
|
onDraft={(() => {
|
|
|
const key = `${state.scope}:${ui.editAgentID}`
|
|
const key = `${state.scope}:${ui.editAgentID}`
|