Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5537bc4
Updated Chat Assistant and Social Post Generator tutorials
AccordionGuy Nov 13, 2024
ae1381a
Update requirements - code editor is optional
AccordionGuy Nov 19, 2024
c320c26
Additional updates based on Sam's review
AccordionGuy Nov 22, 2024
2d9f481
Fixes to screenshots
AccordionGuy Nov 27, 2024
5623afb
Updates for 0.8.1 interface
AccordionGuy Dec 3, 2024
2a2e4ab
Minor text fixes
AccordionGuy Dec 3, 2024
a041f1a
Merge pull request #629 from AccordionGuy/tutorial-update
ramedina86 Dec 3, 2024
ce8c338
fix: Cannot add tool when dragging by image
ramedina86 Dec 3, 2024
a416de5
test: Improve workflows E2E tests
ramedina86 Dec 3, 2024
7958f10
test: Make Workflows tests less flaky
ramedina86 Dec 3, 2024
b1c14da
chore: Change capitalization, spelling
ramedina86 Dec 3, 2024
c7c955b
test: Improve e2e workflows
ramedina86 Dec 3, 2024
ba1bdf0
test: Improve e2e workflows
ramedina86 Dec 3, 2024
99fcb0d
Merge pull request #673 from writer/fix-not-draggable-toolkit
ramedina86 Dec 3, 2024
6d80060
Fix: Correct image path from 'images/Quickstart' to 'images/quickstart
ajot Dec 3, 2024
c3a8b74
fix: properly process tool calls with no arguments
mmikita95 Dec 4, 2024
7a49671
fix: optional parameters for `create_function_tool`
mmikita95 Dec 4, 2024
2792d91
chore: refactor for cleaner structure
mmikita95 Dec 4, 2024
9930c13
fix: edge case of callable entry not being retrieved
mmikita95 Dec 4, 2024
8724ea5
Merge pull request #674 from ajot/amit-fix-quickstart-readme-typo
ramedina86 Dec 4, 2024
642d626
feat: Global events
ramedina86 Dec 4, 2024
366556c
fix: Mypy fixes
ramedina86 Dec 4, 2024
83a5153
Merge pull request #675 from mmikita95/fix-no-arguments-tool-calls
ramedina86 Dec 4, 2024
47932bb
chore: tests for AI module tool calls
mmikita95 Nov 18, 2024
b10b0fc
Merge pull request #677 from writer/feat-jobs-foundation
ramedina86 Dec 5, 2024
7167f7c
Merge pull request #678 from mmikita95/tests-ai-tool-calls
ramedina86 Dec 5, 2024
d3e8a7e
fix(ui): fix Field align binding
madeindjs Dec 6, 2024
bac994b
fix(ui): improve design of collapse button
madeindjs Dec 6, 2024
1efc789
Merge pull request #681 from madeindjs/fix-align
ramedina86 Dec 6, 2024
403e6d4
fix(ui): adapt collapser arrow direction for columns
madeindjs Dec 7, 2024
462dcab
Merge pull request #682 from madeindjs/fix-collapse-button
ramedina86 Dec 9, 2024
395cbbf
feat: Custom block icons
ramedina86 Dec 9, 2024
428425d
chore: version bump
ramedina86 Dec 9, 2024
f663ac2
Merge pull request #685 from writer/feat-support-icon-alias
ramedina86 Dec 9, 2024
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
6 changes: 3 additions & 3 deletions apps/default/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ def increment(state):
print("The counter has been incremented.")
_update_message(state)

# Initialise the state
# Initialize the state

# "_my_private_element" won't be serialised or sent to the frontend,
# "_my_private_element" won't be serialized or sent to the frontend,
# because it starts with an underscore

initial_state = wf.init_state({
"my_app": {
"title": "MY APP"
"title": "My app"
},
"_my_private_element": 1337,
"message": None,
Expand Down
393 changes: 317 additions & 76 deletions docs/framework/chat-assistant.mdx

Large diffs are not rendered by default.

Binary file modified docs/framework/images/tutorial/chat/chat_assistant_1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions docs/framework/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ writer edit hello-world
After running this command, you'll see a local URL displayed in your command line. Open this URL in a web browser to access the editor.

<Frame caption="Writer Framework editor opens at https://localhost:4005">
<img src="/framework/images/Quickstart/hello-world-editor.png" />
<img src="/framework/images/quickstart/hello-world-editor.png" />
</Frame>

<Steps>
Expand Down Expand Up @@ -85,7 +85,7 @@ If you need to disable this protection, use the flag `--enable-remote-edit`.

Experiment with arranging these components on the canvas to create a simple layout.
<Frame caption="Writer Framework launches the app at https://localhost:3005">
<img src="/framework/images/Quickstart/hello-world-preview.png" />
<img src="/framework/images/quickstart/hello-world-preview.png" />
</Frame>
</Step>

Expand All @@ -109,7 +109,7 @@ If you need to disable this protection, use the flag `--enable-remote-edit`.
Change `"AI STARTER"` to something unique, like `"My First Writer App"`. Save the file, and you’ll see the updated name reflected immediately in the editor.

<Frame caption="App name updated in the Writer Framework editor">
<img src="/framework/images/Quickstart/hello-world-app-name.png" />
<img src="/framework/images/quickstart/hello-world-app-name.png" />
</Frame>
</Step>

Expand Down
525 changes: 403 additions & 122 deletions docs/framework/social-post-generator.mdx

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "writer"
version = "0.8.2"
version = "0.8.3rc1"
description = "An open-source, Python framework for building feature-rich apps that are fully integrated with the Writer platform."
authors = ["Writer, Inc."]
readme = "README.md"
Expand Down
6 changes: 2 additions & 4 deletions src/ui/src/builder/BuilderApp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
:key="selectedId ?? 'noneSelected'"
></BuilderSettings>
</div>
<BuilderPanelSwitcher
class="builderPanelSwitcher"
></BuilderPanelSwitcher>
<BuilderPanelSwitcher class="panelSwitcher"></BuilderPanelSwitcher>
</div>

<!-- INSTANCE TRACKERS -->
Expand Down Expand Up @@ -375,7 +373,7 @@ onMounted(() => {
--notificationsDisplacement: calc(var(--builderSettingsWidth) + 24px);
}

.builderPanelSwitcher {
.panelSwitcher {
grid-column: 2 / 3;
grid-row: 3;
}
Expand Down
4 changes: 2 additions & 2 deletions src/ui/src/builder/settings/BuilderFieldsAlign.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
<div v-if="mode == 'pick' || mode == 'css'" class="main">
<div v-if="mode == 'pick'" class="pickerContainer">
<BuilderSelect
:value="subMode"
:model-value="subMode"
:options="selectOptions"
@input="handleInputSelect"
@update:model-value="handleInputSelect"
/>
</div>

Expand Down
1 change: 1 addition & 0 deletions src/ui/src/builder/sidebar/BuilderSidebarToolkit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<img
:alt="`(Icon for ${tool.name})`"
:src="`./../../../../components/${tool.type}.svg`"
draggable="false"
@error="
!isImageFallback[tool.type]
? handleImageError(
Expand Down
30 changes: 23 additions & 7 deletions src/ui/src/components/core/base/BaseCollapseButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,37 @@
</button>
</template>

<script lang="ts">
export type Direction =
| "left-right"
| "top-bottom"
| "bottom-top"
| "right-left";
</script>

<script setup lang="ts">
import { computed, PropType } from "vue";

const props = defineProps({
direction: {
type: String as PropType<"left-right" | "top-bottom">,
required: true,
},
direction: { type: String as PropType<Direction>, required: true },
});

const isCollapsed = defineModel({ type: Boolean, required: true });

const icon = computed(() =>
props.direction === "left-right" ? "chevron_left" : "keyboard_arrow_up",
);
const icon = computed(() => {
switch (props.direction) {
case "left-right":
return "chevron_left";
case "top-bottom":
return "keyboard_arrow_up";
case "right-left":
return "chevron_right";
case "bottom-top":
return "keyboard_arrow_down";
default:
return "keyboard_arrow_up";
}
});
</script>

<style scoped>
Expand Down
31 changes: 9 additions & 22 deletions src/ui/src/components/core/layout/CoreColumn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
v-if="isCollapsible"
v-model="isCollapsed"
class="collapser"
direction="left-right"
:direction="collapseDirection"
/>
</div>
<div v-if="isCollapsed && fields.title.value" class="collapsedTitle">
Expand Down Expand Up @@ -48,7 +48,6 @@ import {
startCollapsed,
isCollapsible as isCollapsibleField,
} from "@/renderer/sharedStyleFields";
import BaseCollapseButton from "../base/BaseCollapseButton.vue";

const description =
"A layout component that organizes its child components in columns. Must be inside a Column Container component.";
Expand Down Expand Up @@ -100,7 +99,10 @@ export default {
<script setup lang="ts">
import { computed, ComputedRef, inject, Ref, ref, watch } from "vue";
import injectionKeys from "@/injectionKeys";
import BaseContainer from "../base/BaseContainer.vue";
import BaseContainer from "@/components/core/base/BaseContainer.vue";
import BaseCollapseButton from "@/components/core/base/BaseCollapseButton.vue";
import type { Direction } from "@/components/core/base/BaseCollapseButton.vue";

const instancePath = inject(injectionKeys.instancePath);
const instanceData = inject(injectionKeys.instanceData);
const wf = inject(injectionKeys.core);
Expand Down Expand Up @@ -138,6 +140,10 @@ const isCollapsibleToRight = computed(
columnsData.value?.value?.minimumNonCollapsiblePosition,
);

const collapseDirection = computed<Direction>(() =>
isCollapsibleToRight.value ? "right-left" : "left-right",
);

const columnsData: ComputedRef<Ref> = computed(() => {
for (let i = -1; i > -1 * instancePath.length; i--) {
const item = instancePath.at(i);
Expand Down Expand Up @@ -212,25 +218,6 @@ watch(
flex: 0 0 32px;
}

.CoreColumn > .header > .collapser > .collapserArrow {
transition: all 0.5s ease-in-out;
transform: rotate(0deg);
}

.CoreColumn:not(.collapsibleToRight).collapsed
> .header
> .collapser
> .collapserArrow {
transform: rotate(180deg);
}

.CoreColumn.collapsibleToRight:not(.collapsed)
> .header
> .collapser
> .collapserArrow {
transform: rotate(180deg);
}

.CoreColumn.collapsibleToRight > .header {
justify-content: left;
}
Expand Down
1 change: 1 addition & 0 deletions src/ui/src/components/core/layout/CoreSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ const isCollapsed = ref<boolean>(
margin: 16px 16px 0 16px;
display: grid;
grid-template-columns: 1fr auto;
align-items: center;
}
.CoreSection__title--collapsed {
margin: 16px;
Expand Down
21 changes: 0 additions & 21 deletions src/ui/src/components/core/layout/CoreSidebar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,23 +137,6 @@ onMounted(() => {
margin-bottom: 16px;
}

.collapserContainer > .collapser {
flex: 0 0 32px;
}

.collapserContainer .collapserArrow {
transition: all 0.5s ease-in-out;
transform: rotate(0deg);
}

.CoreSidebar.collapsed .collapserArrow {
transform: rotate(180deg);
}

.collapserContainer > .collapser:hover {
background: var(--separatorColor);
}

@media only screen and (max-width: 768px) {
.CoreSidebar {
min-width: 100%;
Expand All @@ -164,9 +147,5 @@ onMounted(() => {
.CoreSidebar.collapsed > .collapserContainer {
margin-bottom: 0;
}

.collapserContainer > .collapser {
transform: rotate(90deg);
}
}
</style>
4 changes: 2 additions & 2 deletions src/ui/src/components/workflows/WorkflowsWorkflow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ import { useDragDropComponent } from "@/builder/useDragDropComponent";
import injectionKeys from "@/injectionKeys";

const renderProxiedComponent = inject(injectionKeys.renderProxiedComponent);
const instancePath = inject(injectionKeys.instancePath);
const workflowComponentId = inject(injectionKeys.componentId);

const rootEl: Ref<HTMLElement | null> = ref(null);
Expand Down Expand Up @@ -224,9 +223,10 @@ async function handleRun() {
callback: () => {
isRunning.value = false;
},
handler: `$runWorkflowById_${workflowComponentId}`,
},
}),
instancePath,
null,
false,
);
}
Expand Down
52 changes: 37 additions & 15 deletions src/ui/src/components/workflows/abstract/WorkflowsNode.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
<template>
<div class="WorkflowsNode">
<div class="title">
<img
:src="`./../../../../components/${component.type}.svg`"
@error="
(ev) =>
!isImageFallback ? handleImageError(ev) : undefined
"
/>
<img :src="imagePath" />
<WorkflowsNodeNamer
:component-id="componentId"
class="nodeNamer"
Expand Down Expand Up @@ -75,7 +69,7 @@ export default {
};
</script>
<script setup lang="ts">
import { computed, inject, ref, watch } from "vue";
import { computed, inject, onMounted, ref, watch } from "vue";
import injectionKeys from "@/injectionKeys";
import { FieldType, WriterComponentDefinition } from "@/writerTypes";
import WorkflowsNodeNamer from "../base/WorkflowsNodeNamer.vue";
Expand All @@ -85,7 +79,7 @@ const wf = inject(injectionKeys.core);
const wfbm = inject(injectionKeys.builderManager);
const componentId = inject(injectionKeys.componentId);
const fields = inject(injectionKeys.evaluatedFields);
const isImageFallback = ref(false);
const imagePath = ref<string>(null);

const component = computed(() => {
const component = wf.getComponentById(componentId);
Expand All @@ -110,12 +104,6 @@ const staticOuts = computed<WriterComponentDefinition["outs"]>(() => {
return processedOuts;
});

function handleImageError(ev: Event) {
const imageEl = ev.target as HTMLImageElement;
imageEl.src = `./../../../../components/workflows_category_${def.value.category}.svg`;
isImageFallback.value = true;
}

function getDynamicKeysFromField(fieldKey: string) {
const fieldType = def.value.fields[fieldKey].type;
const isToolsField = fieldType == FieldType.Tools;
Expand Down Expand Up @@ -154,6 +142,40 @@ function handleOutMousedown(ev: DragEvent, outId: string) {
emit("outMousedown", outId);
}

async function checkIfUrlExists(url: string) {
try {
const response = await fetch(url, { method: "HEAD" });
return response.ok;
} catch {
return false;
}
}

async function getBestAvailableImagePath() {
const paths = [
`./../../../../components/${component.value.type}.svg`,
`./../../../../components/workflows_category_${def.value.category}.svg`,
];

if (wf.featureFlags.value.includes("custom_block_icons")) {
paths.unshift(
`./../../../../static/components/${component.value.id}.svg`,
);
}

for (let i = 0; i < paths.length; i++) {
const path = paths[i];
if (await checkIfUrlExists(path)) {
return path;
}
}
return "";
}

onMounted(async () => {
imagePath.value = await getBestAvailableImagePath();
});

watch(isEngaged, () => {
emit("engaged");
});
Expand Down
3 changes: 3 additions & 0 deletions src/ui/src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,17 @@ export function generateCore() {
? getPayloadFromEvent(event)
: null;
let callback: Function;
let handler: string;

if (event instanceof CustomEvent) {
callback = event.detail?.callback;
handler = event.detail?.handler;
}

const messagePayload = async () => ({
type: event.type,
instancePath,
handler,
payload: await eventPayload,
});

Expand Down
Loading
Loading