1
0
This commit is contained in:
syui 2024-02-15 20:42:00 +09:00
parent 6bd1126582
commit d0927577f5
Signed by: syui
GPG Key ID: 5417CFEBAD92DF56
5 changed files with 29 additions and 4 deletions

View File

@ -4,7 +4,7 @@ USER root
ADD .config /root/.config
WORKDIR /root
ADD ./scpt/entrypoint.sh /
ADD ./test/entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

View File

@ -66,7 +66,7 @@ $ ai bot
`zsh`
```sh
$ ./ai.zsh t
$ ./test/ai.zsh t
```
### docker

View File

@ -81,6 +81,11 @@ pub fn c_bot(c: &Context) {
println!("prompt_sub:{}", prompt_sub);
}
let mut admin = "".to_string();
if c.string_flag("admin").is_ok() {
admin = c.string_flag("admin").unwrap();
}
if check_cid == false && { reason == "mention" || reason == "reply" } || check_cid_run == false && { reason == "mention" || reason == "reply" } {
w_cid(cid.to_string(), log_file(&"n2"), true);
@ -167,6 +172,15 @@ pub fn c_bot(c: &Context) {
println!("{}", str_rep);
w_cid(cid.to_string(), log_file(&"n1"), true);
}
} else if { com == "sh" || com == "/sh" } && handle == &admin {
println!("admin:{}", admin);
let output = Command::new(data_scpt(&"arch")).arg(&prompt).output().expect("zsh");
let d = String::from_utf8_lossy(&output.stdout);
let d = d.to_string();
let text_limit = c_char(d);
let str_rep = reply::post_request(text_limit.to_string(), cid.to_string(), uri.to_string(), cid_root.to_string(), uri_root.to_string()).await;
println!("{}", str_rep);
w_cid(cid.to_string(), log_file(&"n1"), true);
} else {
// openai
let str_openai = openai::post_request(prompt.to_string()).await;

View File

@ -52,7 +52,11 @@ fn main() {
.command(
Command::new("bot")
.alias("b")
.action(bot),
.action(bot)
.flag(
Flag::new("admin", FlagType::String)
.alias("a"),
)
)
.command(
Command::new("follow_all")
@ -256,6 +260,7 @@ fn ascii_art(c: &Context) {
}
fn bot(c: &Context) {
refresh(c);
loop {
c_bot(c);
}
@ -499,6 +504,12 @@ fn img_post(c: &Context) {
fn reply_og(c: &Context) {
refresh(c);
//let mut admin = "".to_string();
//if c.string_flag("admin").is_ok() {
// admin = c.string_flag("admin").unwrap();
//}
let m = c.args[0].to_string();
let link = c.string_flag("link").unwrap();
let cid = c.string_flag("cid").unwrap();

View File

@ -7,7 +7,7 @@ case $OSTYPE in
alias date="/opt/homebrew/bin/gdate"
;;
esac
d=${0:a:h}/test
d=${0:a:h}
source $d/env
source $d/refresh.zsh
source $d/token.zsh