Allow AI interactions to be proxied through Zed's server so you don't need an API key (#7367)

Co-authored-by: Antonio <antonio@zed.dev>

Resurrected this from some assistant work I did in Spring of 2023.
- [x] Resurrect streaming responses
- [x] Use streaming responses to enable AI via Zed's servers by default
(but preserve API key option for now)
- [x] Simplify protobuf
- [x] Proxy to OpenAI on zed.dev
- [x] Proxy to Gemini on zed.dev
- [x] Improve UX for switching between openAI and google models
- We current disallow cycling when setting a custom model, but we need a
better solution to keep OpenAI models available while testing the google
ones
- [x] Show remaining tokens correctly for Google models
- [x] Remove semantic index
- [x] Delete `ai` crate
- [x] Cloud front so we can ban abuse
- [x] Rate-limiting
- [x] Fix panic when using inline assistant
- [x] Double check the upgraded `AssistantSettings` are
backwards-compatible
- [x] Add hosted LLM interaction behind a `language-models` feature
flag.

Release Notes:

- We are temporarily removing the semantic index in order to redesign it
from scratch.

---------

Co-authored-by: Antonio <antonio@zed.dev>
Co-authored-by: Antonio Scandurra <me@as-cii.com>
Co-authored-by: Thorsten <thorsten@zed.dev>
Co-authored-by: Max <max@zed.dev>
This commit is contained in:
Nathan Sobo 2024-03-19 12:22:26 -06:00 committed by GitHub
parent 905a24079a
commit 8ae5a3b61a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
87 changed files with 3647 additions and 8937 deletions

View file

@ -479,7 +479,28 @@ impl SettingsStore {
merge_schema(target_schema, setting_schema.schema);
}
fn merge_schema(target: &mut SchemaObject, source: SchemaObject) {
fn merge_schema(target: &mut SchemaObject, mut source: SchemaObject) {
let source_subschemas = source.subschemas();
let target_subschemas = target.subschemas();
if let Some(all_of) = source_subschemas.all_of.take() {
target_subschemas
.all_of
.get_or_insert(Vec::new())
.extend(all_of);
}
if let Some(any_of) = source_subschemas.any_of.take() {
target_subschemas
.any_of
.get_or_insert(Vec::new())
.extend(any_of);
}
if let Some(one_of) = source_subschemas.one_of.take() {
target_subschemas
.one_of
.get_or_insert(Vec::new())
.extend(one_of);
}
if let Some(source) = source.object {
let target_properties = &mut target.object().properties;
for (key, value) in source.properties {