From 35c75506e2fd94e2285d8a3cb66208d518d5f992 Mon Sep 17 00:00:00 2001 From: sigoden Date: Mon, 27 Nov 2023 14:04:50 +0800 Subject: feat: support vision (#249) * feat: support vision * clippy * implement vision * resolve data url to local file * add model openai:gpt-4-vision-preview * use newline to concate embeded text files * set max_tokens for gpt-4-vision-preview --- src/render/mod.rs | 4 ++-- src/render/stream.rs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/render') diff --git a/src/render/mod.rs b/src/render/mod.rs index 1e20ccc..dc4c081 100644 --- a/src/render/mod.rs +++ b/src/render/mod.rs @@ -5,7 +5,7 @@ pub use self::markdown::{MarkdownRender, RenderOptions}; use self::stream::{markdown_stream, raw_stream}; use crate::client::Client; -use crate::config::GlobalConfig; +use crate::config::{GlobalConfig, Input}; use crate::utils::AbortSignal; use anyhow::{Context, Result}; @@ -17,7 +17,7 @@ use std::io::stdout; use std::thread::spawn; pub fn render_stream( - input: &str, + input: &Input, client: &dyn Client, config: &GlobalConfig, abort: AbortSignal, diff --git a/src/render/stream.rs b/src/render/stream.rs index bc56db8..2c05119 100644 --- a/src/render/stream.rs +++ b/src/render/stream.rs @@ -167,7 +167,7 @@ struct Spinner { } impl Spinner { - const DATA: [&str; 10] = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]; + const DATA: [&'static str; 10] = ["⠋", "⠙", "⠹", "⠸", "⠼", "⠴", "⠦", "⠧", "⠇", "⠏"]; fn new(message: &str) -> Self { Spinner { -- cgit v1.2.3