mirror of
https://github.com/cool-team-official/cool-admin-vue.git
synced 2025-12-12 05:32:48 +00:00
1
This commit is contained in:
parent
4f366ef636
commit
129d401d64
3012
build/cool/eps.d.ts
vendored
3012
build/cool/eps.d.ts
vendored
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,8 @@
|
|||||||
export const proxy = {
|
export const proxy = {
|
||||||
"/dev/": {
|
"/dev/": {
|
||||||
// target: "http://127.0.0.1:8001",
|
// target: "http://127.0.0.1:8001",
|
||||||
target: "http://192.168.0.112:9009",
|
// target: "http://192.168.0.112:9009",
|
||||||
|
target: "https://dev-admin.cool-js.cloud",
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path: string) => path.replace(/^\/dev/, "")
|
rewrite: (path: string) => path.replace(/^\/dev/, "")
|
||||||
},
|
},
|
||||||
|
|||||||
@ -4,8 +4,8 @@ import { getRules } from "./utils";
|
|||||||
export default (): ModuleConfig => {
|
export default (): ModuleConfig => {
|
||||||
return {
|
return {
|
||||||
options: {
|
options: {
|
||||||
host: "/dev"
|
// host: "/dev"
|
||||||
// host: "https://service.cool-js.com"
|
host: "https://service.cool-js.com/api"
|
||||||
},
|
},
|
||||||
toolbar: {
|
toolbar: {
|
||||||
order: 1,
|
order: 1,
|
||||||
|
|||||||
@ -80,7 +80,11 @@
|
|||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-input v-model="form.entity" placeholder="请输入">
|
<el-input
|
||||||
|
v-model="form.entity"
|
||||||
|
maxlength="20"
|
||||||
|
placeholder="请输入"
|
||||||
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<arrow-right-bold />
|
<arrow-right-bold />
|
||||||
@ -103,7 +107,11 @@
|
|||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-input v-model="form.module" placeholder="请输入">
|
<el-input
|
||||||
|
v-model="form.module"
|
||||||
|
maxlength="20"
|
||||||
|
placeholder="请输入"
|
||||||
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<el-popover
|
<el-popover
|
||||||
:ref="setRefs('modulePopover')"
|
:ref="setRefs('modulePopover')"
|
||||||
@ -116,7 +124,7 @@
|
|||||||
>
|
>
|
||||||
<template #reference>
|
<template #reference>
|
||||||
<el-icon class="add">
|
<el-icon class="add">
|
||||||
<circle-plus />
|
<circle-plus-filled />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -154,7 +162,11 @@
|
|||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-input v-model="form.column" placeholder="请输入">
|
<el-input
|
||||||
|
v-model="form.column"
|
||||||
|
maxlength="200"
|
||||||
|
placeholder="请输入"
|
||||||
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<el-icon class="icon">
|
<el-icon class="icon">
|
||||||
<arrow-right-bold />
|
<arrow-right-bold />
|
||||||
@ -177,7 +189,11 @@
|
|||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<el-input v-model="form.other" placeholder="请输入">
|
<el-input
|
||||||
|
v-model="form.other"
|
||||||
|
maxlength="200"
|
||||||
|
placeholder="请输入"
|
||||||
|
>
|
||||||
<template #prefix>
|
<template #prefix>
|
||||||
<el-icon>
|
<el-icon>
|
||||||
<arrow-right-bold />
|
<arrow-right-bold />
|
||||||
@ -220,7 +236,7 @@
|
|||||||
<el-icon class="is-loading">
|
<el-icon class="is-loading">
|
||||||
<refresh />
|
<refresh />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<span>生成 {{ last(code.tabs)?.label }} 代码中</span>
|
<span>生成 {{ codeData?.label }}代码中</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -231,7 +247,7 @@
|
|||||||
v-for="(item, index) in code.tabs"
|
v-for="(item, index) in code.tabs"
|
||||||
:key="index"
|
:key="index"
|
||||||
:class="{
|
:class="{
|
||||||
active: index == code.tabs.length - 1
|
active: code.active == item.value
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
{{ item.label }}
|
{{ item.label }}
|
||||||
@ -251,9 +267,9 @@
|
|||||||
:options="{
|
:options="{
|
||||||
theme: 'ai-code--dark'
|
theme: 'ai-code--dark'
|
||||||
}"
|
}"
|
||||||
v-model="code.tabs[code.tabs.length - 1].content"
|
v-model="codeData.content"
|
||||||
language="typescript"
|
language="typescript"
|
||||||
v-if="last(code.tabs)"
|
v-if="codeData"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -268,7 +284,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="tsx" setup name="helper-ai-code">
|
<script lang="tsx" setup name="helper-ai-code">
|
||||||
import { onMounted, reactive, watch, nextTick } from "vue";
|
import { onMounted, reactive, watch, nextTick, computed } from "vue";
|
||||||
import { useCool, storage, module } from "/@/cool";
|
import { useCool, storage, module } from "/@/cool";
|
||||||
import {
|
import {
|
||||||
Refresh,
|
Refresh,
|
||||||
@ -276,7 +292,7 @@ import {
|
|||||||
Back,
|
Back,
|
||||||
ArrowRightBold,
|
ArrowRightBold,
|
||||||
Loading,
|
Loading,
|
||||||
CirclePlus,
|
CirclePlusFilled,
|
||||||
QuestionFilled
|
QuestionFilled
|
||||||
} from "@element-plus/icons-vue";
|
} from "@element-plus/icons-vue";
|
||||||
import { ElLoading, ElMessage, ElMessageBox } from "element-plus";
|
import { ElLoading, ElMessage, ElMessageBox } from "element-plus";
|
||||||
@ -366,6 +382,7 @@ const step = reactive({
|
|||||||
// 代码
|
// 代码
|
||||||
const code = reactive({
|
const code = reactive({
|
||||||
tabs: [] as { label: string; value: string; content: string }[],
|
tabs: [] as { label: string; value: string; content: string }[],
|
||||||
|
active: "",
|
||||||
|
|
||||||
// 生成中
|
// 生成中
|
||||||
loading: false,
|
loading: false,
|
||||||
@ -446,25 +463,22 @@ const code = reactive({
|
|||||||
content: ""
|
content: ""
|
||||||
};
|
};
|
||||||
|
|
||||||
|
code.active = flow;
|
||||||
code.tabs.push(item);
|
code.tabs.push(item);
|
||||||
|
|
||||||
if (item) {
|
let content = "";
|
||||||
let content = "";
|
|
||||||
|
|
||||||
ai.invokeFlow(flow, { ...form, ...data }, (res) => {
|
ai.invokeFlow(flow, { ...form, ...data }, (res) => {
|
||||||
if (res.isEnd) {
|
if (res.isEnd) {
|
||||||
resolve(item.content);
|
resolve(item.content);
|
||||||
} else {
|
} else {
|
||||||
content += res.content;
|
content += res.content;
|
||||||
|
|
||||||
if (content.indexOf("```typescript\n") == 0) {
|
if (content.indexOf("```typescript\n") == 0) {
|
||||||
item.content = content
|
item.content = content.replace(/^```typescript\n/g, "").replace(/```$/, "");
|
||||||
.replace(/^```typescript\n/g, "")
|
|
||||||
.replace(/```$/, "");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -475,14 +489,16 @@ const code = reactive({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const codeData = computed(() => {
|
||||||
|
return code.tabs.find((e) => e.value == code.active);
|
||||||
|
});
|
||||||
|
|
||||||
// 滚动文案
|
// 滚动文案
|
||||||
const desc = reactive({
|
const desc = reactive({
|
||||||
list: [] as string[],
|
list: [] as string[],
|
||||||
text: "",
|
text: "",
|
||||||
|
|
||||||
change() {
|
change() {
|
||||||
console.log(111);
|
|
||||||
|
|
||||||
switch (step.value) {
|
switch (step.value) {
|
||||||
case "enter":
|
case "enter":
|
||||||
desc.list = ["请简要描述您的功能,AI帮你写代码"];
|
desc.list = ["请简要描述您的功能,AI帮你写代码"];
|
||||||
@ -830,14 +846,6 @@ function toDoc() {
|
|||||||
window.open("https://cool-js.com/");
|
window.open("https://cool-js.com/");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听表单
|
|
||||||
watch(
|
|
||||||
() => form,
|
|
||||||
(val) => {
|
|
||||||
storage.set("ai-create.form", val);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
onMounted(() => {
|
onMounted(() => {
|
||||||
desc.init();
|
desc.init();
|
||||||
});
|
});
|
||||||
@ -920,6 +928,7 @@ $color: #41d1ff;
|
|||||||
padding: 6px 13px 6px 10px;
|
padding: 6px 13px 6px 10px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: all 0.2s;
|
transition: all 0.2s;
|
||||||
|
font-size: 14px;
|
||||||
|
|
||||||
.el-icon {
|
.el-icon {
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
@ -932,13 +941,18 @@ $color: #41d1ff;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.panel {
|
.panel {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 1040px;
|
width: 1040px;
|
||||||
|
max-width: calc(100% - 40px);
|
||||||
|
|
||||||
.editor {
|
.editor {
|
||||||
background-color: #080e14;
|
background-color: #080e14;
|
||||||
margin-bottom: 60px;
|
width: 100%;
|
||||||
|
|
||||||
.topbar {
|
.topbar {
|
||||||
display: flex;
|
display: flex;
|
||||||
@ -990,7 +1004,7 @@ $color: #41d1ff;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.head {
|
.head {
|
||||||
padding: 25vh 0 50px 0;
|
padding: 50px 0;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
line-height: 1;
|
line-height: 1;
|
||||||
@ -1027,7 +1041,7 @@ $color: #41d1ff;
|
|||||||
padding: 0 1px;
|
padding: 0 1px;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-size: 22px;
|
font-size: 22px;
|
||||||
margin-top: 100px;
|
margin-top: 50px;
|
||||||
|
|
||||||
&::after {
|
&::after {
|
||||||
content: "";
|
content: "";
|
||||||
@ -1121,8 +1135,8 @@ $color: #41d1ff;
|
|||||||
}
|
}
|
||||||
|
|
||||||
.form {
|
.form {
|
||||||
transform: translateY(40vh);
|
transform: translateY(50vh);
|
||||||
width: 1000px;
|
width: calc(100% - 40px);
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
|
|
||||||
@ -1137,7 +1151,7 @@ $color: #41d1ff;
|
|||||||
padding: 10px 0;
|
padding: 10px 0;
|
||||||
|
|
||||||
.row {
|
.row {
|
||||||
font-size: 14px;
|
font-size: 12px;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
||||||
&:last-child {
|
&:last-child {
|
||||||
@ -1148,12 +1162,10 @@ $color: #41d1ff;
|
|||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
padding: 5px 15px;
|
padding: 5px 15px;
|
||||||
color: #999;
|
|
||||||
|
|
||||||
.el-icon {
|
.el-icon {
|
||||||
margin-left: 4px;
|
margin-left: 4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-size: 12px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1201,8 +1213,8 @@ $color: #41d1ff;
|
|||||||
color: #eee;
|
color: #eee;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin: 50px 0 0 0;
|
|
||||||
user-select: none;
|
user-select: none;
|
||||||
|
margin-top: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.module-list {
|
.module-list {
|
||||||
@ -1224,20 +1236,23 @@ $color: #41d1ff;
|
|||||||
|
|
||||||
&.show {
|
&.show {
|
||||||
transform: translateY(0);
|
transform: translateY(0);
|
||||||
|
|
||||||
|
.btns {
|
||||||
|
margin-top: 60px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.coding {
|
.coding {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
bottom: 0;
|
bottom: 20px;
|
||||||
left: 0;
|
left: 0;
|
||||||
transition: all 0.3s ease;
|
transition: all 0.3s ease;
|
||||||
height: 0;
|
height: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
animation: coding 0.3s forwards;
|
animation: coding 0.3s forwards;
|
||||||
border: 5px solid rgba(255, 255, 255, 0.1);
|
border: 5px solid rgba(255, 255, 255, 0.1);
|
||||||
border-radius: 10px 10px 0 0;
|
box-sizing: border-box;
|
||||||
border-bottom: 0;
|
|
||||||
|
|
||||||
.editor {
|
.editor {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
@ -1262,6 +1277,7 @@ $color: #41d1ff;
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
margin-left: auto;
|
margin-left: auto;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
|
font-size: 12px;
|
||||||
|
|
||||||
.el-icon {
|
.el-icon {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
@ -1336,7 +1352,7 @@ $color: #41d1ff;
|
|||||||
|
|
||||||
&.is-coding {
|
&.is-coding {
|
||||||
.head {
|
.head {
|
||||||
transform: translateY(-120px);
|
transform: translateY(-180px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user