Browse Source

Merge branch 'main' of https://git.shalu.com/Shalu/shalu-agent-workflow

jiaxing.liao 3 weeks ago
parent
commit
1ca580438f

+ 1 - 0
.gitignore

@@ -4,6 +4,7 @@
 node_modules
 .pnp
 .pnp.js
+.idea/
 
 # Local env files
 .env

+ 8 - 0
.idea/modules.xml

@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules>
+      <module fileurl="file://$PROJECT_DIR$/.idea/shalu-agent-workflow.iml" filepath="$PROJECT_DIR$/.idea/shalu-agent-workflow.iml" />
+    </modules>
+  </component>
+</project>

+ 12 - 0
.idea/shalu-agent-workflow.iml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module type="WEB_MODULE" version="4">
+  <component name="NewModuleRootManager">
+    <content url="file://$MODULE_DIR$">
+      <excludeFolder url="file://$MODULE_DIR$/.tmp" />
+      <excludeFolder url="file://$MODULE_DIR$/temp" />
+      <excludeFolder url="file://$MODULE_DIR$/tmp" />
+    </content>
+    <orderEntry type="inheritedJdk" />
+    <orderEntry type="sourceFolder" forTests="false" />
+  </component>
+</module>

+ 6 - 0
.idea/vcs.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="" vcs="Git" />
+  </component>
+</project>

+ 126 - 0
.idea/workspace.xml

@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="AutoImportSettings">
+    <option name="autoReloadType" value="SELECTIVE" />
+  </component>
+  <component name="ChangeListManager">
+    <list default="true" id="41cd2400-3735-4e1a-9a77-7ea2e4a1c041" name="更改" comment="合并冲突">
+      <change afterPath="$PROJECT_DIR$/apps/web/store/componentsMap.ts" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/apps/web/src/components/setter/HttpSetter.vue" beforeDir="false" afterPath="$PROJECT_DIR$/apps/web/src/components/setter/HttpSetter.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/apps/web/src/components/setter/index.vue" beforeDir="false" afterPath="$PROJECT_DIR$/apps/web/src/components/setter/index.vue" afterDir="false" />
+      <change beforePath="$PROJECT_DIR$/pnpm-lock.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pnpm-lock.yaml" afterDir="false" />
+    </list>
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="Git.Merge.Settings">
+    <option name="BRANCH" value="feature-0123-Ai-workFlow" />
+  </component>
+  <component name="Git.Settings">
+    <option name="RECENT_BRANCH_BY_REPOSITORY">
+      <map>
+        <entry key="$PROJECT_DIR$" value="main" />
+      </map>
+    </option>
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
+  </component>
+  <component name="ProjectColorInfo">{
+  &quot;associatedIndex&quot;: 7
+}</component>
+  <component name="ProjectId" id="38m4mc5E2lcGRA9UjefZP9wo9yp" />
+  <component name="ProjectViewState">
+    <option name="hideEmptyMiddlePackages" value="true" />
+    <option name="showLibraryContents" value="true" />
+  </component>
+  <component name="PropertiesComponent"><![CDATA[{
+  "keyToString": {
+    "RunOnceActivity.ShowReadmeOnStart": "true",
+    "git-widget-placeholder": "feature-0123-Ai-workFlow",
+    "last_opened_file_path": "/Users/liujie/Desktop/shalu/shalu-agent-workflow",
+    "node.js.detected.package.eslint": "true",
+    "node.js.detected.package.tslint": "true",
+    "node.js.selected.package.eslint": "(autodetect)",
+    "node.js.selected.package.tslint": "(autodetect)",
+    "nodejs_package_manager_path": "pnpm",
+    "settings.editor.selected.configurable": "preferences.keymap",
+    "ts.external.directory.path": "/Users/liujie/Desktop/shalu/shalu-agent-workflow/node_modules/typescript/lib",
+    "vue.rearranger.settings.migration": "true"
+  }
+}]]></component>
+  <component name="SharedIndexes">
+    <attachedChunks>
+      <set>
+        <option value="bundled-js-predefined-d6986cc7102b-5c90d61e3bab-JavaScript-WS-242.23726.96" />
+      </set>
+    </attachedChunks>
+  </component>
+  <component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
+  <component name="SvnConfiguration">
+    <configuration>$USER_HOME$/.subversion</configuration>
+  </component>
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="默认任务">
+      <changelist id="41cd2400-3735-4e1a-9a77-7ea2e4a1c041" name="更改" comment="" />
+      <created>1769391572649</created>
+      <option name="number" value="Default" />
+      <option name="presentableId" value="Default" />
+      <updated>1769391572649</updated>
+      <workItem from="1769391573741" duration="223000" />
+      <workItem from="1769391800519" duration="10090000" />
+    </task>
+    <task id="LOCAL-00001" summary="合并冲突">
+      <option name="closed" value="true" />
+      <created>1769392417458</created>
+      <option name="number" value="00001" />
+      <option name="presentableId" value="LOCAL-00001" />
+      <option name="project" value="LOCAL" />
+      <updated>1769392417458</updated>
+    </task>
+    <task id="LOCAL-00002" summary="合并冲突">
+      <option name="closed" value="true" />
+      <created>1769392717747</created>
+      <option name="number" value="00002" />
+      <option name="presentableId" value="LOCAL-00002" />
+      <option name="project" value="LOCAL" />
+      <updated>1769392717747</updated>
+    </task>
+    <task id="LOCAL-00003" summary="合并冲突">
+      <option name="closed" value="true" />
+      <created>1769392895672</created>
+      <option name="number" value="00003" />
+      <option name="presentableId" value="LOCAL-00003" />
+      <option name="project" value="LOCAL" />
+      <updated>1769392895672</updated>
+    </task>
+    <task id="LOCAL-00004" summary="合并冲突">
+      <option name="closed" value="true" />
+      <created>1769393225277</created>
+      <option name="number" value="00004" />
+      <option name="presentableId" value="LOCAL-00004" />
+      <option name="project" value="LOCAL" />
+      <updated>1769393225277</updated>
+    </task>
+    <option name="localTasksCounter" value="5" />
+    <servers />
+  </component>
+  <component name="TypeScriptGeneratedFilesManager">
+    <option name="version" value="3" />
+  </component>
+  <component name="Vcs.Log.Tabs.Properties">
+    <option name="TAB_STATES">
+      <map>
+        <entry key="MAIN">
+          <value>
+            <State />
+          </value>
+        </entry>
+      </map>
+    </option>
+  </component>
+  <component name="VcsManagerConfiguration">
+    <MESSAGE value="合并冲突" />
+    <option name="LAST_COMMIT_MESSAGE" value="合并冲突" />
+  </component>
+</project>

+ 1 - 0
apps/web/package.json

@@ -14,6 +14,7 @@
     "element-plus": "^2.13.1",
     "normalize.css": "^8.0.1",
     "uuid": "^13.0.0",
+    "pinia": "^3.0.4",
     "vue": "^3.5.24",
     "vue-router": "4"
   },

+ 2 - 16
apps/web/src/components/setter/HttpSetter.vue

@@ -21,26 +21,12 @@ const props = withDefaults(
 const emit = defineEmits<{
     'update:visible': [value: boolean]
 }>()
+
 </script>
 <template>
     <div class='content'>
-        <ElDrawer :model-value="visible" :show-close="false" size="25%" @close="emit('update:visible', false)">
-
-            <template #header>
-                <h4>HTTP请求</h4>
-                <Icon icon="lucide:x" height="24" width="24"></Icon>
-            </template>
-
-            <!-- Drawer content -->
-            This is drawer content.
 
-            <!-- <template #footer>
-                <ElButton type="success" size="large" class="w-full" @click="emit('update:visible', false)">
-                    运行
-                </ElButton>
-            </template> -->
 
-        </ElDrawer>
     </div>
 </template>
-<style lang="scss" scoped></style>
+<style lang="scss" scoped></style>

+ 67 - 2
apps/web/src/components/setter/index.vue

@@ -2,26 +2,91 @@
  * @Author: liuJie
  * @Date: 2026-01-25 22:13:06
  * @LastEditors: liuJie
- * @LastEditTime: 2026-01-25 22:26:30
+ * @LastEditTime: 2026-01-27 10:01:23
  * @Describe: file describe
 -->
 <script lang="ts" setup>
 import HttpSetter from './HttpSetter.vue';
+import { Icon } from "@iconify/vue";
+import { useComponentMapInspector } from "@/store"
+
+const store = useComponentMapInspector()
+
+console.log(store.componentMap['http'])
+
 interface Props {
     data: any, // 暂时定义
     visible: boolean
 }
 const props = withDefaults(defineProps<Props>(), {
     id: '',
+    data: null,
     visible: false
 })
 const emit = defineEmits<{
     'update:visible': [value: boolean]
 }>()
+const closeDrawer = () => {
+    emit('update:visible', false)
+}
 </script>
 <template>
     <div class='setter'>
+        <div class="drawer shadow-2xl" :class="{ 'drawer--open': props.visible }">
+            <header>
+                <h4>HTTP请求</h4>
+                <Icon icon="lucide:x" height="24" width="24" @click="closeDrawer" class="cursor-pointer"></Icon>
+            </header>
+            <div class="content">
+                <component :is="'http-node'" :data="props.data"></component>
+            </div>
+        </div>
+
         <HttpSetter :data="data" v-model:visible="props.visible" />
     </div>
 </template>
-<style lang="less" scoped></style>
+<style lang="less" scoped>
+.setter {
+
+    /* Drawer 主体 */
+    .drawer {
+        position: fixed;
+        top: 100px;
+        right: 5px;
+        bottom: 10px;
+        width: 420px;
+        background: #fff;
+        z-index: 1000;
+        border-radius: 8px;
+        display: flex;
+        flex-direction: column;
+        border: 1px solid #e4e4e4;
+
+        /* 初始隐藏状态 */
+        transform: translateX(100%);
+        transition: transform 0.25s ease;
+    }
+
+    /* 显示状态 */
+    .drawer--open {
+        transform: translateX(0);
+    }
+
+    /* Header */
+    .drawer header {
+        height: 56px;
+        padding: 0 16px;
+        border-bottom: 1px solid #eee;
+        display: flex;
+        align-items: center;
+        justify-content: space-between;
+    }
+
+    /* 内容区 */
+    .drawer .content {
+        flex: 1;
+        padding: 16px;
+        overflow-y: auto;
+    }
+}
+</style>

+ 3 - 1
apps/web/src/main.ts

@@ -1,6 +1,7 @@
 import { createApp } from 'vue'
 import './style.css'
 import App from './App.vue'
+import store from './store'
 import router from './router'
 import ElementPlus from 'element-plus'
 import 'element-plus/dist/index.css'
@@ -9,11 +10,12 @@ import 'virtual:svg-icons-register'
 import 'normalize.css'
 import 'virtual:uno.css'
 
+
 // Set Element Plus theme colors
 const app = createApp(App)
+app.use(store)
 app.use(router)
 app.use(ElementPlus)
-
 const root = document.documentElement
 const primaryColor = '#ff6b6b'
 

+ 21 - 0
apps/web/src/store/index.ts

@@ -0,0 +1,21 @@
+/*
+ * @Author: liuJie
+ * @Date: 2026-01-26 21:52:39
+ * @LastEditors: liuJie
+ * @LastEditTime: 2026-01-27 10:10:22
+ * @Describe: file describe
+ */
+import type { App } from "vue";
+import { createPinia } from "pinia";
+import useComponentMapInspector from "@/store/modules/materialSetterMaps.store"
+import useConditionOptionsStore from "@/store/modules/conditionNode.store"
+import useHttpOptionsStore from "@/store/modules/httpNode.store"
+
+const pinia = createPinia();
+
+const store = (app: App<Element>) => {
+    app.use(pinia);
+}
+export { useComponentMapInspector, useConditionOptionsStore, useHttpOptionsStore };
+
+export default store;

+ 25 - 0
apps/web/src/store/modules/conditionNode.store.ts

@@ -0,0 +1,25 @@
+/*
+ * @Author: liuJie
+ * @Date: 2026-01-27 10:05:01
+ * @LastEditors: liuJie
+ * @LastEditTime: 2026-01-27 10:09:54
+ * @Describe: 往对应节点里存储选项信息
+ */
+
+import { defineStore } from "pinia";
+
+export const useConditionOptionsStore = defineStore('conditionOptions', {
+    state: () => ({
+        currentNodeOptions: null as null | Record<string, any>,
+    }),
+    actions: {
+        setCurrentNodeOptions(options: Record<string, any>) {
+            this.currentNodeOptions = options;
+        },
+        clearCurrentNodeOptions() {
+            this.currentNodeOptions = null;
+        }
+    },
+})
+
+export default useConditionOptionsStore;

+ 25 - 0
apps/web/src/store/modules/httpNode.store.ts

@@ -0,0 +1,25 @@
+/*
+ * @Author: liuJie
+ * @Date: 2026-01-27 10:08:16
+ * @LastEditors: liuJie
+ * @LastEditTime: 2026-01-27 10:10:16
+ * @Describe: file describe
+ */
+
+import { defineStore } from "pinia";
+
+export const useHttpOptionsStore = defineStore('httpOptions', {
+    state: () => ({
+        currentNodeOptions: null as null | Record<string, any>,
+    }),
+    actions: {
+        setCurrentNodeOptions(options: Record<string, any>) {
+            this.currentNodeOptions = options;
+        },
+        clearCurrentNodeOptions() {
+            this.currentNodeOptions = null;
+        }
+    },
+})
+
+export default useHttpOptionsStore;

+ 38 - 0
apps/web/src/store/modules/materialSetterMaps.store.ts

@@ -0,0 +1,38 @@
+/*
+ * @Author: liuJie
+ * @Date: 2026-01-26 17:22:54
+ * @LastEditors: liuJie
+ * @LastEditTime: 2026-01-27 10:06:32
+ * @Describe: 异步组件映射
+ */
+import {defineAsyncComponent, shallowRef} from "vue";
+import { defineStore } from "pinia";
+
+const useComponentMapInspector = defineStore('componentMapInspector', {
+    state: () => ({
+        componentMap: {
+            http: shallowRef(
+                defineAsyncComponent({
+                    loader:()=>import('@/components/setter/HttpSetter.vue'),
+                    // errorComponent:  错误组件
+                })),
+            condition: shallowRef(
+                defineAsyncComponent({
+                    loader:()=>import('@/components/setter/ConditionSetter.vue'),
+                    // errorComponent:  错误组件
+                })),
+            database: shallowRef(
+                defineAsyncComponent({
+                    loader:()=>import('@/components/setter/DatabaseSetter.vue'),
+                    // errorComponent:  错误组件
+                })),
+            code: shallowRef(
+                defineAsyncComponent({
+                    loader:()=>import('@/components/setter/CodeSetter.vue'),
+                    // errorComponent:  错误组件
+                }))
+        },
+    }),
+})
+
+export default useComponentMapInspector