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