-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Wox and Wox.Plugin versions and improve feature validations
This commit updates Wox and Wox.Plugin to version 0.0.67. It also refactors the handling of PluginSettingValidator for improved code clarity and maintainability. Additionally, it now checks if a plugin has the right to access a feature before accessing it to enhance security. Features for LLMStream usage now include explicit permissions.
- Loading branch information
1 parent
3edbaca
commit 87a272d
Showing
21 changed files
with
324 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export namespace llm { | ||
export type ConversationRole = "user" | "system" | ||
export type ChatStreamDataType = "streaming" | "finished" | "error" | ||
|
||
export interface Conversation { | ||
Role: ConversationRole | ||
Text: string | ||
Timestamp: number | ||
} | ||
|
||
export type ChatStreamFunc = (dataType: ChatStreamDataType, data: string) => void | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import { Context, Platform } from "./index.js" | ||
|
||
export type PluginSettingDefinitionType = "head" | "textbox" | "checkbox" | "select" | "label" | "newline" | "table" | "dynamic" | ||
|
||
|
||
export interface PluginSettingValueStyle { | ||
PaddingLeft: number | ||
PaddingTop: number | ||
PaddingRight: number | ||
PaddingBottom: number | ||
|
||
Width: number | ||
LabelWidth: number // if has label, E.g. select, checkbox, textbox | ||
} | ||
|
||
export interface PluginSettingDefinitionValue { | ||
GetKey: () => string | ||
GetDefaultValue: () => string | ||
Translate: (translator: (ctx: Context, key: string) => string) => void | ||
} | ||
|
||
export interface PluginSettingDefinitionItem { | ||
Type: PluginSettingDefinitionType | ||
Value: PluginSettingDefinitionValue | ||
DisabledInPlatforms: Platform[] | ||
IsPlatformSpecific: boolean // if true, this setting may be different in different platforms | ||
} | ||
|
||
export interface MetadataCommand { | ||
Command: string | ||
Description: string | ||
} | ||
|
||
export interface PluginSettingValueCheckBox extends PluginSettingDefinitionValue { | ||
Key: string | ||
Label: string | ||
DefaultValue: string | ||
Tooltip: string | ||
Style: PluginSettingValueStyle | ||
} | ||
|
||
export interface PluginSettingValueDynamic extends PluginSettingDefinitionValue { | ||
Key: string | ||
} | ||
|
||
export interface PluginSettingValueHead extends PluginSettingDefinitionValue { | ||
Content: string | ||
Tooltip: string | ||
Style: PluginSettingValueStyle | ||
} | ||
|
||
export interface PluginSettingValueLabel extends PluginSettingDefinitionValue { | ||
Content: string | ||
Tooltip: string | ||
Style: PluginSettingValueStyle | ||
} | ||
|
||
export interface PluginSettingValueNewline extends PluginSettingDefinitionValue { | ||
Style: PluginSettingValueStyle | ||
} | ||
|
||
export interface PluginSettingValueSelect extends PluginSettingDefinitionValue { | ||
Key: string | ||
Label: string | ||
Suffix: string | ||
DefaultValue: string | ||
Tooltip: string | ||
Options: PluginSettingValueSelectOption[] | ||
Validators: PluginSettingValidator[] // validators for this setting, every validator should be satisfied | ||
|
||
Style: PluginSettingValueStyle | ||
} | ||
|
||
export interface PluginSettingValueSelectOption { | ||
Label: string | ||
Value: string | ||
} | ||
|
||
export type PluginSettingValidatorType = "is_number" | "not_empty" | ||
|
||
export interface PluginSettingValidator { | ||
Type: PluginSettingValidatorType | ||
Value: PluginSettingValidatorValue | ||
} | ||
|
||
export interface PluginSettingValidatorValue { | ||
GetValidatorType(): PluginSettingValidatorType | ||
} | ||
|
||
export interface PluginSettingValidatorIsNumber extends PluginSettingValidatorValue { | ||
IsInteger: boolean | ||
IsFloat: boolean | ||
} | ||
|
||
export interface PluginSettingValidatorNotEmpty extends PluginSettingValidatorValue { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.