Skip to content

Commit

Permalink
chore: examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Seedsa committed May 22, 2024
1 parent 44666a7 commit 30fdfd2
Show file tree
Hide file tree
Showing 38 changed files with 862 additions and 690 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
node_modules
/dist
/lib
examples/dist

auto-imports.d.ts
components.d.ts
Expand Down
7 changes: 0 additions & 7 deletions api/hello.mjs

This file was deleted.

12 changes: 4 additions & 8 deletions examples/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
:extensions="extensions"
:max-height="1024"
:min-height="512"
output="json"
maxWidth="900"
:dark="theme === 'dark'"
/>
Expand All @@ -48,7 +47,6 @@ import {
CodeBlock,
FontSize,
Highlight,
TextAlign,
Table,
Clear,
Blockquote,
Expand All @@ -68,7 +66,7 @@ import {
Columns,
} from 'echo-editor'
import OpenAI from 'openai'
import { DEMO_CONTENT } from './demo-content'
import { DEMO_CONTENT } from './initContent'
const content = ref(DEMO_CONTENT)
const theme = ref<string | null>(null)
Expand All @@ -94,7 +92,6 @@ const extensions = [
MoreMark,
Color.configure({ spacer: true }),
Highlight,
TextAlign.configure({ spacer: true }),
BulletList,
OrderedList,
Indent,
Expand Down Expand Up @@ -128,9 +125,9 @@ const extensions = [
CodeBlock,
Table,
ImportWord.configure({ spacer: true }),
AI.configure({
completions: text => AICompletions(text),
}),
// AI.configure({
// completions: text => AICompletions(text),
// }),
]
async function AICompletions(text?: string) {
// 从.env中获取key 请自行替换
Expand All @@ -140,7 +137,6 @@ async function AICompletions(text?: string) {
console.error('请配置VITE_OPENAI_API_KEY')
return
}
console.log('tex', text)
const openai = new OpenAI({
apiKey: apiKey,
dangerouslyAllowBrowser: true,
Expand Down
14 changes: 14 additions & 0 deletions examples/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!doctype html>
<html lang="zh-hans">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<link rel="icon" href="/favicon.ico" />
<title>Echo Editor Examples</title>
</head>
<body>
<div id="app"></div>
<script type="module" src="./main.ts"></script>
</body>
</html>
201 changes: 201 additions & 0 deletions examples/initContent.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/initContent.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
8 changes: 8 additions & 0 deletions examples/main.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/main.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions examples/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"name": "examples",
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "vite build"
},
"dependencies": {
"echo-editor": "workspace:*",
"openai": "4.47.1"
Expand Down
Loading

0 comments on commit 30fdfd2

Please sign in to comment.