Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/ai-conversation.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ The **+** button holds Skills and examples. Skills chosen there apply to every t
The **Copilot** tab of the editor is the conversation about the open widget. A widget made in the AI window continues the conversation it was made in; any other widget starts one when you first write to it.

- The AI works on a copy of the widget. Each version it makes is drawn small in the panel, and the widget and the editor stay as they are.
- **Apply to Editor** writes the version on screen into the open document and saves it. If the document changed since the panel last looked, nothing is written and the conversation continues from the editor's code instead. Undo in the editor restores what was there.
- **Apply** writes the version on screen into the open document and saves it. If the document changed since the panel last looked, nothing is written and the conversation continues from the editor's code instead. Undo in the editor restores what was there.
- Code the conversation has not seen (you typed in the editor, or used the Layout panel) is taken over as a version marked "Code from the editor" before your next request, so the AI always changes what you see.
- The copy contains the widget's other files, so a widget that imports its own files or reads its own images runs as it does in the widget. A widget with more than 300 files or 20 MB is too large for this, and the panel says so.
- The copy runs with the widget's own permissions. If a version declares a host the widget may not contact yet, Apply asks first and adds the network permission for that host to the widget.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ struct AIConversationTurnsView: View {
}

private func manualEdit(_ turn: AIConversationTurn) -> some View {
HStack(spacing: 8) {
// Two lines: side by side they do not fit the editor's narrow panel.
VStack(alignment: .leading, spacing: 3) {
Label("Code from the editor", systemImage: "pencil.line")
.font(.caption)
.foregroundStyle(.secondary)
Expand Down
6 changes: 5 additions & 1 deletion macOS/ScriptWidgetMac/Editor/EditorPanelView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -353,11 +353,15 @@ private struct StudioCopilotConversationView: View {
shownCode = ShownCode(title: "Version \(conversation.currentVersion?.number ?? 0)", code: session.currentSource)
}
.controlSize(.small)
Button("Apply to Editor", systemImage: "checkmark") {
// The panel is narrow: a longer title is cut off.
Button("Apply", systemImage: "checkmark") {
if hostsToAllow.isEmpty { apply(allowingHosts: false) } else { confirmingNetwork = true }
}
.buttonStyle(.borderedProminent)
.controlSize(.small)
.fixedSize()
.help("Write this version into the editor")
.accessibilityLabel("Apply to Editor")
.disabled(isApplying || !canWork)
}
.padding(10)
Expand Down
Loading