|
@@ -1,4 +1,4 @@
|
|
|
-import { Component, createSignal, startTransition } from "solid-js"
|
|
|
|
|
|
|
+import { Component, createMemo, createSignal, startTransition } from "solid-js"
|
|
|
import { Dialog } from "@opencode-ai/ui/v2/dialog-v2"
|
|
import { Dialog } from "@opencode-ai/ui/v2/dialog-v2"
|
|
|
import { TabsV2 } from "@opencode-ai/ui/v2/tabs-v2"
|
|
import { TabsV2 } from "@opencode-ai/ui/v2/tabs-v2"
|
|
|
import { Icon } from "@opencode-ai/ui/icon"
|
|
import { Icon } from "@opencode-ai/ui/icon"
|
|
@@ -11,6 +11,9 @@ import { SettingsModelsV2 } from "./models"
|
|
|
import "./settings-v2.css"
|
|
import "./settings-v2.css"
|
|
|
import { SettingsServersV2 } from "./servers"
|
|
import { SettingsServersV2 } from "./servers"
|
|
|
import { useDialog } from "@opencode-ai/ui/context/dialog"
|
|
import { useDialog } from "@opencode-ai/ui/context/dialog"
|
|
|
|
|
+import { useLayout } from "@/context/layout"
|
|
|
|
|
+import { useTabs } from "@/context/tabs"
|
|
|
|
|
+import { useServerSync } from "@/context/server-sync"
|
|
|
|
|
|
|
|
export const DialogSettings: Component<{
|
|
export const DialogSettings: Component<{
|
|
|
sessionID?: string
|
|
sessionID?: string
|
|
@@ -19,7 +22,20 @@ export const DialogSettings: Component<{
|
|
|
const language = useLanguage()
|
|
const language = useLanguage()
|
|
|
const platform = usePlatform()
|
|
const platform = usePlatform()
|
|
|
const dialog = useDialog()
|
|
const dialog = useDialog()
|
|
|
|
|
+ const layout = useLayout()
|
|
|
|
|
+ const tabs = useTabs()
|
|
|
|
|
+ const serverSync = useServerSync()
|
|
|
const [tab, setTab] = createSignal(props.defaultValue ?? "general")
|
|
const [tab, setTab] = createSignal(props.defaultValue ?? "general")
|
|
|
|
|
+ const directory = createMemo(() => {
|
|
|
|
|
+ const route = layout.route()
|
|
|
|
|
+ if (route.type === "dir-new-sesssion") return route.dir
|
|
|
|
|
+ if (route.type === "draft") {
|
|
|
|
|
+ const draft = tabs.store.find((item) => item.type === "draft" && item.draftID === route.draftID)
|
|
|
|
|
+ return draft?.type === "draft" ? draft.directory : undefined
|
|
|
|
|
+ }
|
|
|
|
|
+ if (route.type === "session") return serverSync().session.get(route.sessionId)?.directory
|
|
|
|
|
+ return undefined
|
|
|
|
|
+ })
|
|
|
|
|
|
|
|
const showProviders = () => {
|
|
const showProviders = () => {
|
|
|
void dialog.show(() => <DialogSettings sessionID={props.sessionID} defaultValue="providers" />)
|
|
void dialog.show(() => <DialogSettings sessionID={props.sessionID} defaultValue="providers" />)
|
|
@@ -87,7 +103,7 @@ export const DialogSettings: Component<{
|
|
|
<SettingsServersV2 />
|
|
<SettingsServersV2 />
|
|
|
</TabsV2.Content>
|
|
</TabsV2.Content>
|
|
|
<TabsV2.Content value="providers" class="settings-v2-panel">
|
|
<TabsV2.Content value="providers" class="settings-v2-panel">
|
|
|
- <SettingsProvidersV2 onBack={showProviders} />
|
|
|
|
|
|
|
+ <SettingsProvidersV2 directory={directory} onBack={showProviders} />
|
|
|
</TabsV2.Content>
|
|
</TabsV2.Content>
|
|
|
<TabsV2.Content value="models" class="settings-v2-panel">
|
|
<TabsV2.Content value="models" class="settings-v2-panel">
|
|
|
<SettingsModelsV2 />
|
|
<SettingsModelsV2 />
|