mirror of
https://shylinux.com/x/ollama-story
synced 2025-04-29 09:09:23 +08:00
add some
This commit is contained in:
parent
45956c5aae
commit
4685812585
@ -1,5 +1,5 @@
|
||||
$output>div.message { padding:20px; overflow:auto; }
|
||||
$output>div.message>div.request { background-color:#94ec69; padding:10px; float:right; }
|
||||
$output>div.message>div.request>span { float:right; }
|
||||
$output>div.message>div.response { white-space:break-spaces; padding:0px; clear:both; }
|
||||
$output>div.request { padding:20px; }
|
||||
$content>div.message { padding:20px; overflow:auto; }
|
||||
$content>div.message>div.request { background-color:#94ec69; padding:10px; float:right; }
|
||||
$content>div.message>div.request>span { float:right; }
|
||||
$content>div.message>div.response { white-space:break-spaces; padding:0px; clear:both; }
|
||||
$content>div.request { padding:20px; }
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
type chat struct {
|
||||
client client
|
||||
list string `name:"list list" help:"大模型对话"`
|
||||
list string `name:"list list" help:"大模型对话" icon:"src/main.png"`
|
||||
}
|
||||
|
||||
func (s chat) Request(m *ice.Message, arg ...string) {
|
||||
|
@ -1,8 +1,14 @@
|
||||
Volcanos(chat.ONIMPORT, {
|
||||
_init: function(can, msg) {
|
||||
can.db.model = msg.Append("NAME")
|
||||
can.ui = can.page.Append(can, can._output, [
|
||||
{view: chat.MESSAGE},
|
||||
_init: function(can, msg) { can.ui = can.onappend.layout(can), can.ui.responseList = []
|
||||
msg.Table(function(value) { can.onimport.item(can, {name: value.NAME}, function(event, item, show, target) {
|
||||
can.onimport.tabsCache(can, item, target, function() { can.onimport.content(can, target) })
|
||||
can.db.model = item.name, can.ui.message = target._message
|
||||
can.onappend._status(can, msg), can.onimport.layout(can)
|
||||
}) })
|
||||
},
|
||||
content: function(can, target) {
|
||||
var ui = can.page.Append(can, can.ui.content, [
|
||||
{view: chat.MESSAGE, list: [{text: "有什么问题尽管问吧!"}]},
|
||||
{view: chat.REQUEST, list: [
|
||||
{type: html.TEXTAREA, onkeydown: function(event) {
|
||||
if (event.key == code.ENTER) {
|
||||
@ -10,21 +16,23 @@ Volcanos(chat.ONIMPORT, {
|
||||
}
|
||||
}},
|
||||
]},
|
||||
])
|
||||
can.ui.response = can.page.Append(can, can.ui.message, [{view: chat.RESPONSE, list: [{text: "有什么问题尽管问吧!"}]}])._target
|
||||
]); target._message = ui.message
|
||||
},
|
||||
_grow: function(can, msg, which, text) { var data = JSON.parse(text)
|
||||
can.page.Append(can, can.ui.response, [{text: data.message.content}]), can.ui.message.scrollBy(0, 1000)
|
||||
_grow: function(can, msg, which, text) {
|
||||
var target = can.ui.responseList[parseInt(which)-1], data = JSON.parse(text)
|
||||
can.page.Append(can, target, [{text: data.message.content}]), can.ui.message.scrollBy(0, 1000)
|
||||
},
|
||||
layout: function(can) {
|
||||
can.ui.layout(can.ConfHeight(), can.ConfWidth(), 0, function() {
|
||||
can.page.style(can, can.ui.message, html.MAX_HEIGHT, can.ConfHeight()-140)
|
||||
})
|
||||
}
|
||||
})
|
||||
Volcanos(chat.ONACTION, {
|
||||
request: function(event, can, text) {
|
||||
can.page.Append(can, can.ui.message, [{view: chat.REQUEST, list: [{text: text}]}])
|
||||
can.ui.response = can.page.Append(can, can.ui.message, [{view: chat.RESPONSE}])._target
|
||||
can.request(event, {which: "respone", model: can.db.model})
|
||||
var response = can.page.Append(can, can.ui.message, [{view: chat.RESPONSE}])._target; can.ui.responseList.push(response)
|
||||
can.request(event, {which: ""+can.ui.responseList.length, model: can.db.model})
|
||||
can.runAction(event, chat.REQUEST, [text], function(msg) {})
|
||||
},
|
||||
})
|
@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"shylinux.com/x/ice"
|
||||
_ "shylinux.com/x/icebergs/misc/md"
|
||||
_ "shylinux.com/x/ollama-story/src/client"
|
||||
_ "shylinux.com/x/ollama-story/src/server"
|
||||
)
|
||||
|
6
src/option.go
Normal file
6
src/option.go
Normal file
@ -0,0 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "shylinux.com/x/ice/devops"
|
||||
_ "shylinux.com/x/icebergs/misc/md"
|
||||
)
|
Loading…
x
Reference in New Issue
Block a user