Compare commits

...

2 Commits

@ -1,4 +1,4 @@
# TODO
# TODO for gui_egui
## Features
- Add config editor

@ -1,16 +1,31 @@
use std::collections::HashMap;
use crate::config::{ParamType, AI};
use anyhow::{Context, Result};
use flume::Sender;
use once_cell::sync::Lazy;
use reqwest::Client;
use ron::Value as RonValue;
use serde::{Deserialize, Serialize};
use serde_json::Value;
static CLIENT: Lazy<Client> = Lazy::new(Client::new);
#[derive(Deserialize, Clone, PartialEq, Debug)]
pub struct AI {
pub name: String,
pub url: String,
pub params: HashMap<String, ParamType>,
pub retriever: Vec<RonValue>,
}
#[derive(Deserialize, Clone, PartialEq, Debug)]
pub enum ParamType {
String(String),
Prompt(Option<String>),
Temperature,
MaxTokens,
}
#[derive(Clone, Serialize, Deserialize)]
pub struct Params {
pub prompt: String,

@ -1,8 +1,7 @@
use std::collections::HashMap;
use ron::value::Value;
use serde::Deserialize;
use crate::ai::AI;
#[derive(Deserialize, Debug)]
pub struct Config {
pub app: App,
@ -13,19 +12,3 @@ pub struct Config {
pub struct App {
pub history_dir: Option<String>,
}
#[derive(Deserialize, Clone, PartialEq, Debug)]
pub struct AI {
pub name: String,
pub url: String,
pub params: HashMap<String, ParamType>,
pub retriever: Vec<Value>,
}
#[derive(Deserialize, Clone, PartialEq, Debug)]
pub enum ParamType {
String(String),
Prompt(Option<String>),
Temperature,
MaxTokens,
}

@ -14,8 +14,7 @@ use eframe::{
use egui_notify::Toasts;
use ai_core::{
ai::{generate_with_mpsc, Params, Response, ResponseType},
config::AI,
ai::{generate_with_mpsc, Params, Response, ResponseType, AI},
history::{read_all_history, write_history, HistoryEntry},
};