提交 cb8cab3c 编写于 作者: DCloud_JSON's avatar DCloud_JSON

1.0.3发插件市场

上级 96425f42
......@@ -225,9 +225,6 @@ module.exports = async (obj) => {
请参考文档:[云函数通过https访问其他服务器时出现“certificate has expired”](faq.md#lets-encrypt-cert)
## 已知问题
- App-Vue3 使用highlight.js 因特殊正则引起报错,导致消息内容出错
## 其他
DCloud基于`uni-ai`提供了很多开源模板,除了本项目`uni-ai-chat`,还有:
......
## 1.0.3(2023-04-27
## 1.0.3(2023-05-09
- 新增 提供了商业化能力,与uni-ai对话消耗积分。积分可通过看[激励视频广告](https://uniapp.dcloud.net.cn/component/ad-rewarded-video.html)获得。
- 优化 根据配置的llm服务商以及是否开启流式响应,自动处理是否逐字返回
- 修复 llm服务商为openai时,内容换行位置不正确的问题
......
@import "@/lib/highlight/github-dark.min.css";
/* #ifndef APP-NVUE */
.rich-text-box ::v-deep pre.hljs {
padding: 5px 8px;
margin: 5px 0;
overflow: auto;
}
.cursor {
display: none;
}
.show-cursor .cursor {
display: inline-block;
color: blue;
font-weight: bold;
animation: blinking 1s infinite;
}
@keyframes blinking {
from {
opacity: 1.0;
}
to {
opacity: 0.0;
}
}
/* #endif */
/* #ifdef H5 */
.copy-box {
position: fixed;
}
// .copy-mask{
// background-color: rgba(255,255,255,0.5);
// width: 100vw;
// height: 100vh;
// position: fixed;
// top: 0;
// left: 0;
// z-index: 9;
// }
.copy {
position: fixed;
background-color: #fff;
box-shadow: 0 0 3px #aaa;
padding: 5px;
border-radius: 5px;
z-index: 999;
cursor: pointer;
font-size: 14px;
color: #222;
}
.copy:hover {
color: #00a953;
}
/* #endif */
\ No newline at end of file
......@@ -13,10 +13,11 @@
<script>
import MarkdownIt from '@/lib/markdown-it.min.js';
import hljs from "@/lib/highlight/highlight.min.js";
// hljs是由 Highlight.js 经兼容性修改后的文件,请勿直接升级。否则会造成uni-app-vue3-Android下有兼容问题
import hljs from "@/lib/highlight/highlight-uni.min.js";
// import hljs from "highlight.js";
// import parseHtml from '@/lib/html-parser.js';
import parseHtml from '@/lib/html-parser.js';
// console.log('hljs--',hljs);
// console.log('hljs--',hljs.getLanguage('js'));
......@@ -93,14 +94,15 @@
computed: {
html() {
if(this.md.split("```").length%2){
return markdownIt.render(this.md + ' <span class="cursor">|</span>');
return markdownIt.render(this.md + ' \n <span class="cursor">|</span>');
}else{
return markdownIt.render(this.md) + ' \n <span class="cursor">|</span>';
}
},
nodes() {
return this.html
// return parseHtml(this.html)
// return this.html
// console.log('parseHtml(this.html)',parseHtml(this.html));
return parseHtml(this.html)
}
},
methods: {
......@@ -118,67 +120,7 @@
</script>
<style lang="scss">
@import "@/lib/highlight/github-dark.min.css";
/* #ifndef APP-NVUE */
.rich-text-box ::v-deep pre.hljs {
padding: 5px 8px;
margin: 5px 0;
overflow: auto;
}
.cursor {
display: none;
}
.show-cursor .cursor {
display: inline-block;
color: blue;
font-weight: bold;
animation: blinking 1s infinite;
}
@keyframes blinking {
from {
opacity: 1.0;
}
to {
opacity: 0.0;
}
}
/* #endif */
/* #ifdef H5 */
.copy-box {
position: fixed;
}
// .copy-mask{
// background-color: rgba(255,255,255,0.5);
// width: 100vw;
// height: 100vh;
// position: fixed;
// top: 0;
// left: 0;
// z-index: 9;
// }
.copy {
position: fixed;
background-color: #fff;
box-shadow: 0 0 3px #aaa;
padding: 5px;
border-radius: 5px;
z-index: 999;
cursor: pointer;
font-size: 14px;
color: #222;
}
.copy:hover {
color: #00a953;
}
/* #ifndef VUE3 && APP-PLUS */
@import "@/components/uni-ai-msg/uni-ai-msg.scss";
/* #endif */
</style>
\ No newline at end of file
此差异已折叠。
此差异已折叠。
......@@ -54,7 +54,8 @@
},
"oauth" : {
"univerify" : {}
}
},
"push" : {}
}
}
},
......@@ -85,10 +86,13 @@
"uniStatistics" : {
"enable" : false
},
"vueVersion" : "3",
"vueVersion" : "2",
"h5" : {
"unipush" : {
"enable" : true
"enable" : false
},
"devServer" : {
"port" : 8080
}
},
"fallbackLocale" : "zh-Hans"
......
......@@ -46,7 +46,7 @@
<uni-icons @click="clear" type="trash" size="24" color="#888"></uni-icons>
</view>
<view class="textarea-box">
<textarea v-model="content" class="textarea" :auto-height="!isWidescreen" :disabled="inputBoxDisabled"
<textarea v-model="content" :cursor-spacing="15" class="textarea" :auto-height="!isWidescreen" :disabled="inputBoxDisabled"
:placeholder="placeholderText" :maxlength="-1" placeholder-class="input-placeholder"></textarea>
</view>
<view class="send-btn-box">
......@@ -483,6 +483,10 @@
</script>
<style lang="scss">
/* #ifdef VUE3 && APP-PLUS */
@import "@/components/uni-ai-msg/uni-ai-msg.scss";
/* #endif */
/* #ifndef APP-NVUE */
view,
textarea,
......@@ -736,6 +740,7 @@
.content {
background-color: #f9f9f9;
position: relative;
max-width: 90%;
}
// .copy {
// color: #888888;
......
......@@ -201,17 +201,17 @@ module.exports = {
res.on('message', async (message) => {
reply += message
await channel.write(message)
console.log('---message----', message)
// console.log('---message----', message)
})
}else{
res.on('line', async (line) => {
await channel.write(reply? ("\n\n " + line) : line)
reply += line
console.log('---line----', line)
// console.log('---line----', line)
})
}
res.on('end', async () => {
console.log('---end----',reply)
// console.log('---end----',reply)
messages.push({
"content": reply,
"role": "assistant"
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册