Skip to content
代码片段 群组 项目
提交 b116670f 编辑于 作者: GitLab Bot's avatar GitLab Bot
浏览文件

Automatic merge of gitlab-org/gitlab master

No related branches found
No related tags found
无相关合并请求
audit-event-types-verify:
variables:
SETUP_DB: "false"
extends:
- .default-retry
- .ruby-cache
- .default-before_script
- .audit-event-types:rules:audit-event-types-verify
stage: lint
needs: []
script:
- bundle exec rake gitlab:audit_event_types:check_docs
......@@ -444,7 +444,6 @@
- "{,ee/,jh/}{app,bin,config,db,elastic,generator_templates,gems,haml_lint,lib,locale,public,scripts,storybook,symbol,vendor}/**/*"
# Auto-generated files
- "doc/api/graphql/reference/*"
- "doc/administration/audit_event_types.md"
# CI changes
- ".gitlab-ci.yml"
- ".gitlab/ci/**/*"
......@@ -470,7 +469,6 @@
- "{,ee/,jh/}{app,bin,config,db,elastic,generator_templates,gems,haml_lint,lib,locale,public,scripts,storybook,symbol,vendor}/**/*"
# Auto-generated files
- "doc/api/graphql/reference/*"
- "doc/administration/audit_event_types.md"
# CI changes
- ".gitlab-ci.yml"
- ".gitlab/ci/**/*"
......@@ -503,7 +501,6 @@
- "{,ee/,jh/}{app,bin,config,db,elastic,generator_templates,gems,haml_lint,lib,locale,public,scripts,storybook,symbol,vendor}/**/*"
# Auto-generated files
- "doc/api/graphql/reference/*"
- "doc/administration/audit_event_types.md"
# CI changes
- ".gitlab-ci.yml"
- ".gitlab/ci/**/*"
......@@ -533,7 +530,6 @@
- "{,ee/,jh/}{app,bin,config,db,elastic,generator_templates,gems,haml_lint,lib,locale,public,scripts,storybook,symbol,vendor}/**/*"
# Auto-generated files
- "doc/api/graphql/reference/*"
- "doc/administration/audit_event_types.md"
# CI changes
- ".gitlab-ci.yml"
- ".gitlab/ci/**/*"
......@@ -572,7 +568,6 @@
- "{,ee/,jh/}{app,bin,config,db,elastic,generator_templates,gems,haml_lint,lib,locale,public,scripts,storybook,symbol,vendor}/**/*"
# Auto-generated files
- "doc/api/graphql/reference/*"
- "doc/administration/audit_event_types.md"
# CI changes
- ".gitlab-ci.yml"
- ".gitlab/ci/**/*"
......@@ -651,6 +646,11 @@
- GITLAB_SHELL_VERSION
- GITALY_SERVER_VERSION
.audit-events-patterns: &audit-events-patterns
- "{,ee/}config/audit_events/types/*.yml"
- "doc/administration/audit_event_types.md"
- "tooling/audit_events/docs/templates/audit_event_types.md.erb"
##################
# Conditions set #
##################
......@@ -1191,7 +1191,7 @@
- <<: *if-not-ee
when: never
- <<: *if-default-refs
changes: *code-backstage-qa-patterns
changes: *audit-events-patterns
##################
# Frontend rules #
......
......@@ -187,6 +187,19 @@ semgrep-appsec-custom-rules:
paths:
- gl-sast-report.json
audit-event-types-verify:
variables:
SETUP_DB: "false"
extends:
- .default-retry
- .ruby-cache
- .default-before_script
- .audit-event-types:rules:audit-event-types-verify
stage: lint
needs: []
script:
- bundle exec rake gitlab:audit_event_types:check_docs
ping-appsec-for-sast-findings:
stage: lint
image: alpine:latest
......
......@@ -6,6 +6,7 @@ module Anthropic
module Completions
class CategorizeQuestion < Gitlab::Llm::Completions::Base
SCHEMA_URL = 'iglu:com.gitlab/ai_question_category/jsonschema/1-2-0'
OUTPUT_TOKEN_LIMIT = 200
private_class_method def self.load_xml(filename)
File.read(File.join(File.dirname(__FILE__), '..', '..', 'fixtures', filename)).tr("\n", '')
......@@ -41,6 +42,7 @@ def execute
def request(template)
@ai_client.complete(
max_tokens_to_sample: OUTPUT_TOKEN_LIMIT,
prompt: template.to_prompt
)&.dig("completion").to_s.strip
end
......
......@@ -7,7 +7,7 @@ class CategorizeQuestion
include Gitlab::Utils::StrongMemoize
PROMPT = <<~PROMPT
\n\nHuman: You are helpful assistant, ready to give as accurate answer as possible in JSON format.
\n\nHuman: You are helpful assistant, ready to give as accurate answer as possible, in JSON format (i.e. starts with "{" and ends with "}").
Based on the information below (user input, categories, labels, language, %<previous_answer_prefix>s), classify user input's category, detailed_category, labels. There may be multiple labels. Don't provide clarification or explanation. Always return only a JSON hash, e.g.:
<example>{"category": "Write, improve, or explain code", "detailed_category": "What are the potential security risks in this code?", "labels": ["contains_credentials", "contains_rejection_previous_answer_incorrect"], "language": "en"}</example>
......
......@@ -38,7 +38,7 @@
allow(template).to receive(:to_prompt).and_return(prompt)
end
allow_next_instance_of(::Gitlab::Llm::Anthropic::Client) do |ai_client|
allow(ai_client).to receive(:complete).with(prompt: prompt).and_return(response)
allow(ai_client).to receive(:complete).with(prompt: prompt, max_tokens_to_sample: 200).and_return(response)
end
allow_next_instance_of(::Gitlab::Llm::ChatStorage, user) do |storage|
allow(storage).to receive(:messages_up_to).with(chat_message.id).and_return(messages)
......
......@@ -51,7 +51,7 @@ pre-push:
graphql_docs:
tags: documentation
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: '{app/graphql/**/*.rb,ee/app/graphql/**/*.rb}'
glob: '{,ee/}app/graphql/**/*.rb'
run: bundle exec rake gitlab:graphql:check_docs
vale: # Requires Vale: https://docs.gitlab.com/ee/development/documentation/testing.html#install-linters
tags: documentation style
......@@ -103,7 +103,7 @@ pre-push:
audit_event_types_docs:
tags: documentation
files: git diff --name-only --diff-filter=d $(git merge-base origin/master HEAD)..HEAD
glob: '{config/audit_events/types/*.yml,ee/config/audit_events/types/*yml,doc/administration/audit_event_streaming/audit_event_types.md}'
glob: '{config/audit_events/types/*.yml,ee/config/audit_events/types/*yml,doc/administration/audit_event_types.md,tooling/audit_events/docs/templates/audit_event_types.md.erb}'
run: bundle exec rake gitlab:audit_event_types:check_docs
rubocop:
tags: backend style
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册