Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions docs/deepseek-suite.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# DeepSeek suite and Q&A web search

The recognition pipeline selector has three persistent choices: Traditional,
Multimodal and DeepSeek suite. Closing Settings, closing a window and restarting
the app preserve the selected pipeline. Each keeps its own configuration.

DeepSeek suite uses the dedicated application credential `deepseek_suite.config`
(`apiKey`, `voice`). First setup copies the first enabled, configured official
DeepSeek LLM channel key in channel order. Once saved, the suite credential is
independent, including an explicitly empty key. Configuration never reorders or
modifies traditional or multimodal channels. The suite resolves to a synthetic
provider with the official endpoint and `deepseek-flash`; traditional local ASR
fallback settings do not apply. The dedicated credential stays in the local vault.

## Speech

ASR uses `POST /v1/tools/asr`, multipart `file` only, with 16 kHz mono PCM WAV.
Recording completes before upload. Long recordings are split into at most
120-second segments (under the 8 MiB limit). Model, language and prompt fields
are not sent. Transcripts are joined using the existing batch ASR behavior.

Only the DeepSeek suite pipeline exposes read aloud, guarded in both the UI and
native command. The Q&A answer's read-aloud control streams DeepSeek PCM over WebSocket through
the native host, then schedules 24 kHz signed 16-bit audio in the WebView. The API
key stays in the host. `stella` and `tide` voices are available. The explicit
`finish` event must report success; early closure and provider errors fail the
playback. Stop, replacement and window/component disposal cancel playback.
Read-aloud starts on user action after an answer is complete; it does not speak
partial model output automatically. The host currently exposes playback to the
Tauri Q&A and main windows.

## Search

Traditional and multimodal Q&A use Advanced → Web Search: free Bing RSS (the
default), Tavily, Brave, SearXNG or Off. The legacy Auto value is a free-search
alias. Even a traditional DeepSeek LLM channel uses this standalone search path.
The model first chooses a short query or no search.

Only the DeepSeek suite pipeline enables `deepseek_web_search` and
`deepseek_read_url`, using its own key, `deepseek-flash`, Chat Completions and the
exact official HTTPS endpoint. It does not borrow the standalone search settings.
Native final-chunk citations become clickable source links; content-filter and
stream-error responses discard the partial answer. Every answering prompt names
the actual search backend (or states that search is off).

For free search, up to three public result pages are fetched with bounded time and size, DNS pinning and no redirects or credentials; unavailable pages retain their snippets. When requested, at most five bounded snippets are passed to the answering model
as untrusted evidence. This planning call incurs normal model usage even when no
search is needed. Missing weather location requires clarification. Free search
requires no key, but its public RSS interface can be unavailable or rate-limited.
Failure or empty results instruct the model to disclose that live facts could
not be verified. SearXNG requires a user-supplied `/search` endpoint with JSON
output enabled. Search keys are scoped to their selected fixed API origin.

Configuration is stored in the local credential store as `web_search.config`;
it does not enter provider credential sync. Search queries are sent to the chosen
search service and snippets to the answering model. Turning search off bypasses
planning and search. Native DeepSeek search and speech are paid provider services.

Conversation history retains answer text and displayed source links. Encrypted
DeepSeek tool-result signatures are not retained, so subsequent turns may search
or read links again rather than reuse earlier server-side page context.

## Conversation and presentation

Fn + Space starts a general voice question. Only an explicit nonempty native
selection is attached; the QA path never synthesizes Copy to infer selection.
The chord consumes Space down, repeats and release, while a plain Space passes
through. Prompts do not annotate the absence of a selection.

Until the user closes Q&A, subsequent questions retain its conversation and
messages. Recording and processing keep the previous answer expanded and visible;
a separate recording capsule displays the “Ask anything” badge. Focus loss does
not hide the Q&A panel. Cancelling a turn preserves the conversation; dismissing
it clears the conversation for the next question.

Each answer ends with numbered source chips on the left (site icons with a globe
fallback), Copy on the right, then suite-only Read aloud. Entrance, hover, press
and playback animations respect reduced-motion preferences.

## Official contracts

- [DeepSeek November 13 announcement](https://api-docs.deepseek.com/news/news261113/)
- [DeepSeek ASR](https://api-docs.deepseek.com/zh-cn/guides/asr/)
- [DeepSeek TTS](https://api-docs.deepseek.com/zh-cn/guides/tts/)
- [DeepSeek web tools](https://api-docs.deepseek.com/zh-cn/guides/web_tools/)
- [Tavily search](https://docs.tavily.com/documentation/api-reference/endpoint/search)
- [Brave authentication](https://api-dashboard.search.brave.com/documentation/guides/authentication)
- [SearXNG search API](https://docs.searxng.org/dev/search_api.html)
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
- [CI 触发范围与缓存配额](ci-trigger-and-cache-policy.md):改动范围门控、10 GB 缓存分配与维护、发版预热点。
- [Android APK / 悬浮窗计划](android-mobile-apk-overlay-plan.md)(实施中)
- [Android 输入法](android-ime.md):语音、笔画、英文、轻量拼音、后台服务与真机验收入口。
- [DeepSeek 大统一与联网追问](deepseek-suite.md):ASR、流式朗读、原生联网与免费搜索配置。
- [火山引擎 ASR 配置](volcengine-setup.md)
- [讯飞(iflytek)ASR 配置](xfyun-asr.md)
- [百炼(DashScope)ASR 模型](bailian-asr-models.md)
Expand Down
4 changes: 4 additions & 0 deletions docs/linux-egui-command-event-baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
"create_channel",
"create_style_pack_from_template",
"debug_read_cursor_context",
"deepseek_tts_start",
"deepseek_tts_stop",
"delete_channel",
"delete_channel_if_blank",
"delete_history_entry",
Expand Down Expand Up @@ -143,7 +145,9 @@
"open_shizuku_app",
"open_system_settings",
"preview_style_pack_runtime",
"qa_cancel_turn",
"qa_set_edit_instruction_mode",
"qa_stop_recording",
"qa_submit_text",
"qa_toggle_recording",
"qa_window_dismiss",
Expand Down
1 change: 1 addition & 0 deletions openless-all/app/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions openless-all/app/crates/openless-capsule/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ pub struct CapsulePopupState {
/// Selection polish shares the capsule window but shows a one-line notice.
#[serde(default)]
pub selection_polish: bool,
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub qa: bool,
/// Display name of the translation target, already localized by the host.
#[serde(default)]
pub translation_target: Option<String>,
Expand All @@ -62,6 +64,7 @@ pub struct CapsuleLabels {
pub inserted: String,
pub translate_to: String,
pub translating: String,
pub asking: String,
pub polishing: String,
pub replaced: String,
pub no_selection: String,
Expand Down Expand Up @@ -199,6 +202,12 @@ impl CapsuleLabels {
inserted,
translate_to,
translating,
asking: if locale.starts_with("zh") {
"随便问"
} else {
"Ask anything"
}
.into(),
polishing,
replaced,
no_selection,
Expand Down
33 changes: 31 additions & 2 deletions openless-all/app/crates/openless-capsule/src/pill.rs
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,13 @@ impl DefaultCapsule {
time(if layer_visible { 0.0 } else { 0.12 }),
LINEAR,
);
let badge_visible = state.translation_active && recording && !leaving;
let badge_visible = (state.translation_active && recording
|| state.qa
&& matches!(
state.phase.as_str(),
"recording" | "transcribing" | "polishing"
))
&& !leaving;
let (badge_duration, badge_delay) = if badge_visible { (0.2, 0.04) } else { (0.12, 0.0) };
for (tween, target) in [
(&mut self.badge_opacity, if badge_visible { 1.0 } else { 0.0 }),
Expand Down Expand Up @@ -698,7 +704,7 @@ impl DefaultCapsule {
}
let badge_bottom = body_top
- STACK_GAP
- if rail_visible && state.translation_active {
- if rail_visible && (state.translation_active || state.qa) {
RAIL_HEIGHT + STACK_GAP
} else {
0.0
Expand Down Expand Up @@ -884,6 +890,29 @@ fn badge(
opacity: f32,
pixels_per_point: f32,
) -> Vec<Shape> {
if frame.state.qa {
let label = painter.layout_job(LayoutJob::single_section(
frame.labels.asking.clone(),
format(11.0, 500.0, 16.5, tokens.pill.ink),
));
let size = label.size();
let rect = Rect::from_min_size(
pos2(
bottom_center.x - size.x / 2.0 - 10.0,
bottom_center.y - 26.0,
),
vec2(size.x + 20.0, 26.0),
);
return vec![
egui::epaint::RectShape::filled(rect, 8, tokens.pill.fill.gamma_multiply(opacity))
.into(),
text(
pos2(rect.left() + 10.0, rect.center().y - size.y / 2.0),
label,
opacity,
),
];
}
let fade = |color: Color32| color.gamma_multiply(opacity);
let label = painter.layout_job(LayoutJob::single_section(
frame.labels.translate_to.clone(),
Expand Down
15 changes: 11 additions & 4 deletions openless-all/app/crates/openless-capsule/src/renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ const CAPSULE_BOTTOM_INSET: f32 = 16.0;
/// 徽章与药丸之间的间距(Tauri `badgeGap`)。
const CAPSULE_BADGE_GAP: f32 = 8.0;

fn translating_badge(ui: &mut egui::Ui, pill: egui::Rect, labels: &CapsuleLabels) {
let label = labels.translating.as_str();
fn context_badge(ui: &mut egui::Ui, pill: egui::Rect, label: &str) {
let text_width = layout::text_width(ui, label, 10.5);
let width = text_width + 5.0 + 5.0 + 20.0;
let height = 19.0;
Expand Down Expand Up @@ -71,8 +70,16 @@ pub fn dictation_capsule(
egui::vec2(PILL_WIDTH, PILL_HEIGHT),
);
let _ = ui.allocate_rect(rect, egui::Sense::hover());
if state.translation_active {
translating_badge(ui, rect, labels);
if state.translation_active || state.qa {
context_badge(
ui,
rect,
if state.qa {
&labels.asking
} else {
&labels.translating
},
);
}
let center = rect.shrink(3.0);
let processing = matches!(
Expand Down
1 change: 1 addition & 0 deletions openless-all/app/crates/openless-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ md-5 = "0.11.0"
once_cell = "1"
parking_lot = "0.12"
regex = "1"
roxmltree = "0.21.1"
reqwest = { version = "0.12", default-features = false, features = ["json", "multipart", "rustls-tls", "stream", "system-proxy"] }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
Expand Down
48 changes: 33 additions & 15 deletions openless-all/app/crates/openless-core/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2848,7 +2848,8 @@ impl HistoryProviderAttribution {
llm_call_label: Option<&crate::polish::LlmCallLabel>,
) -> Self {
match context.pipeline_mode {
crate::shared_types::PipelineMode::Traditional => Self {
crate::shared_types::PipelineMode::Traditional
| crate::shared_types::PipelineMode::Deepseek => Self {
asr_provider: Some(
asr_call_label
.map(|label| label.provider.clone())
Expand Down Expand Up @@ -5040,7 +5041,9 @@ impl OpenLessBackend {
self.recover_cloud_notes()?;
}
let before = self.get_preferences();
let warmed = self.deps.credential_store.status(before).await;
let warmed =
crate::deepseek_suite::credentials_status(self.deps.credential_store.as_ref(), before)
.await;
if let Some(sync) = &self.encrypted_sync {
// Keep Settings available even after a denied/failed warm read.
// The service records its own retryable recovery/storage error;
Expand All @@ -5056,7 +5059,11 @@ impl OpenLessBackend {
// Recovery can replace both preferences and credentials. Recompute
// from the new in-memory target after it has settled.
Ok(_) if self.encrypted_sync.is_some() => {
self.deps.credential_store.status(preferences.clone()).await
crate::deepseek_suite::credentials_status(
self.deps.credential_store.as_ref(),
preferences.clone(),
)
.await
}
Ok(credentials) => Ok(credentials),
Err(error) => Err(error),
Expand Down Expand Up @@ -5862,6 +5869,9 @@ impl OpenLessBackend {
&self,
mut status: CredentialsStatus,
) -> Result<CredentialsStatus, BackendError> {
if status.pipeline_mode == crate::shared_types::PipelineMode::Deepseek {
return Ok(status);
}
if let Some(service) = self.deps.credential_store.siwc() {
let channel_id = self
.deps
Expand Down Expand Up @@ -5895,11 +5905,11 @@ impl OpenLessBackend {
}

pub async fn get_credentials_status(&self) -> Result<CredentialsStatus, BackendError> {
let status = self
.deps
.credential_store
.status(self.get_preferences())
.await?;
let status = crate::deepseek_suite::credentials_status(
self.deps.credential_store.as_ref(),
self.get_preferences(),
)
.await?;
let status = self.with_siwc_status(status).await?;
self.state
.write()
Expand Down Expand Up @@ -6428,6 +6438,9 @@ impl OpenLessBackend {
&self,
preferences: &crate::UserPreferences,
) -> Result<crate::dictation_context::ProviderInvocation, BackendError> {
if preferences.pipeline_mode == crate::shared_types::PipelineMode::Deepseek {
return Ok(crate::deepseek_suite::invocation(true));
}
let provider = match self
.resolve_session_provider(ProviderSlot::Asr, &preferences.active_asr_provider)
.await
Expand Down Expand Up @@ -6627,11 +6640,11 @@ impl OpenLessBackend {
}

pub async fn refresh_and_publish_credentials(&self) -> Result<CredentialsStatus, BackendError> {
let status = self
.deps
.credential_store
.status(self.get_preferences())
.await?;
let status = crate::deepseek_suite::credentials_status(
self.deps.credential_store.as_ref(),
self.get_preferences(),
)
.await?;
let status = self.with_siwc_status(status).await?;
self.state
.write()
Expand Down Expand Up @@ -8679,6 +8692,7 @@ impl OpenLessBackend {
crate::shared_types::split_front_app_opt(context.polish.front_app.as_deref());
let pipeline_mode = match context.pipeline_mode {
crate::shared_types::PipelineMode::Traditional => "traditional",
crate::shared_types::PipelineMode::Deepseek => "deepseek",
crate::shared_types::PipelineMode::Multimodal => "multimodal",
};
let session = DictationSession {
Expand Down Expand Up @@ -8812,6 +8826,7 @@ impl OpenLessBackend {
};
let pipeline_mode = match context.pipeline_mode {
crate::shared_types::PipelineMode::Traditional => "traditional",
crate::shared_types::PipelineMode::Deepseek => "deepseek",
crate::shared_types::PipelineMode::Multimodal => "multimodal",
};
let llm_used = context.uses_llm_polisher()
Expand Down Expand Up @@ -8895,6 +8910,7 @@ impl OpenLessBackend {
crate::shared_types::split_front_app_opt(context.polish.front_app.as_deref());
let pipeline_mode = match context.pipeline_mode {
crate::shared_types::PipelineMode::Traditional => "traditional",
crate::shared_types::PipelineMode::Deepseek => "deepseek",
crate::shared_types::PipelineMode::Multimodal => "multimodal",
};
let attribution = HistoryProviderAttribution::from_context(
Expand Down Expand Up @@ -9383,7 +9399,7 @@ impl OpenLessBackend {
preferences.multimodal_pipeline_enabled,
preferences.pipeline_mode,
);
let traditional = pipeline_mode == crate::shared_types::PipelineMode::Traditional;
let traditional = pipeline_mode != crate::shared_types::PipelineMode::Multimodal;
let active_asr_provider = if traditional && purpose != DictationContextPurpose::QaText {
self.resolve_dictation_asr_provider(&preferences).await?
} else {
Expand All @@ -9393,7 +9409,9 @@ impl OpenLessBackend {
};
let mut deferred_llm_error = None;
let skip_llm_at_capture = purpose == DictationContextPurpose::AuxiliaryVoice;
let active_llm_provider = if traditional && !skip_llm_at_capture {
let active_llm_provider = if pipeline_mode == crate::shared_types::PipelineMode::Deepseek {
crate::deepseek_suite::invocation(false)
} else if traditional && !skip_llm_at_capture {
match self
.resolve_session_provider(ProviderSlot::Llm, &preferences.active_llm_provider)
.await
Expand Down
Loading
Loading