Working on thread titles
This commit is contained in:
@@ -39,3 +39,7 @@ features = ["json", "rustls-tls"]
|
||||
version = "2.1.0"
|
||||
default-features = false
|
||||
features = ["postgres", "32-column-tables", "serde_json", "r2d2", "with-deprecated"]
|
||||
|
||||
[dependencies.rust-bert]
|
||||
version = "0.21.0"
|
||||
features = ["download-libtorch"]
|
||||
11
Dockerfile
11
Dockerfile
@@ -13,10 +13,21 @@ RUN apt-get update && apt-get install -y curl tar xz-utils && \
|
||||
curl -L https://github.com/yt-dlp/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-linux64-gpl.tar.xz > ffmpeg.tar.xz && \
|
||||
tar -xJf ffmpeg.tar.xz --wildcards */bin/ffmpeg --transform='s/^.*\///' && rm ffmpeg.tar.xz
|
||||
|
||||
# FROM debian:bullseye-slim as libraries
|
||||
# WORKDIR /libraries
|
||||
# RUN apt-get update && apt-get install -y unzip && \
|
||||
# curl -L https://download.pytorch.org/libtorch/cu117/libtorch-cxx11-abi-shared-with-deps-2.0.1%2Bcu117.zip > libtorch.zip && \
|
||||
# unzip libtorch.zip && rm libtorch.zip
|
||||
|
||||
FROM debian:bullseye-slim as runtime
|
||||
WORKDIR /siren
|
||||
RUN apt-get update && apt-get install -y libopus-dev libpq5 libpq-dev && apt-get auto-remove -y
|
||||
COPY --from=builder /siren/target/release/siren /usr/local/bin/siren
|
||||
COPY --from=packages /packages /usr/bin
|
||||
# COPY --from=libraries /libraries /usr/lib
|
||||
|
||||
# ARG LIBTORCH=/usr/lib/libtorch
|
||||
# ARG LD_LIBRARY_PATH=${LIBTORCH}/lib:${LD_LIBRARY_PATH}
|
||||
|
||||
# ADD migrations ./
|
||||
CMD ["siren"]
|
||||
|
||||
@@ -290,7 +290,7 @@ pub async fn generate_response(ctx: &Context, msg: &Message, oai: &OAI, pool: &P
|
||||
// Stop the typing indicator and send the response
|
||||
typing.stop();
|
||||
match msg.channel_id.create_public_thread(&ctx.http, msg.id, |thread| {
|
||||
thread.name("Siren Response").kind(ChannelType::PublicThread)
|
||||
thread.name(truncate(&parsed_content, 99)).kind(ChannelType::PublicThread)
|
||||
}).await {
|
||||
Ok(c) => {
|
||||
if let Err(why) = c.say(&ctx.http, response).await {
|
||||
@@ -304,3 +304,25 @@ pub async fn generate_response(ctx: &Context, msg: &Message, oai: &OAI, pool: &P
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn truncate(s: &str, max_chars: usize) -> &str {
|
||||
match s.char_indices().nth(max_chars) {
|
||||
None => s,
|
||||
Some((idx, _)) => &s[..idx],
|
||||
}
|
||||
}
|
||||
|
||||
// fn summarization_model() -> Result<SummarizationModel, RustBertError> {
|
||||
// let config_resource = RemoteResource::from_pretrained(T5ConfigResources::T5_SMALL);
|
||||
// let vocab_resource = RemoteResource::from_pretrained(T5VocabResources::T5_SMALL);
|
||||
// let weights_resource = RemoteResource::from_pretrained(T5ModelResources::T5_SMALL);
|
||||
|
||||
// let summarization_config = SummarizationConfig::new(
|
||||
// ModelType::T5,
|
||||
// ModelResource::Torch(Box::new(weights_resource)),
|
||||
// config_resource,
|
||||
// vocab_resource,
|
||||
// None
|
||||
// );
|
||||
// return SummarizationModel::new(summarization_config);
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user